pmrep is a customizable performance metrics reporting tool. Any available performance metric, live or archived, system and/or application, can be selected for reporting using one of the output alternatives listed below together with applicable formatting options.

pmrep collects the selected metric values through the facilities of the Performance Co-Pilot (PCP), see PCPIntro(1). The metrics to be reported are specified on the command line, in a configuration file, or both. Metrics can be automatically converted and scaled using the PCP facilities, either by default or by per-metric scaling specifications. In addition to the existing metrics, derived metrics can be defined using the arithmetic expressions described in pmRegisterDerived(3).

Unless directed to another host by the -h option, pmrep will contact the Performance Metrics Collector Daemon (PMCD, see pmcd(1)) on the local host.

The -a option causes pmrep to use the specified set of archive logs rather than connecting to a PMCD. The -a and -h options are mutually exclusive.

The -L option causes pmrep to use a local context to collect metrics from DSO PMDAs (Performance Metrics Domain Agents, “plugins”) on the local host without PMCD. Only some metrics are available in this mode. The -a, -h, and -L options are mutually exclusive.

The metrics of interest are named in the metricspec argument(s). If a metricspec specifies a non-leaf node in the Performance Metrics Name Space (PMNS), then pmrep will recursively descend the PMNS and report on all leaf nodes (i.e., metrics) for that metricspec. (Use for example pminfo(1) to list all the leaf nodes and their descriptions.)

A metricspec has three different forms. First, on the command line it can start with a colon (“:”) to indicate a metricset to be read from a pmrep configuration file (see pmrep.conf(5)) which can then consist of any number of metricspecs. Second, a metricspec starting with non-colon specifies a PMNS node as described above, optionally followed by metric formatting definitions (applicable only to leaf nodes). This so-called compact form of a metricspec is defined as follows:

metric[,label[,instance[,unit/scale[,type[,width]]]]]

A valid PMNS node (metric) is mandatory. It can be followed by a text label used by supporting output targets (such as csv and stdout, see below). The optional instance definition restricts csv and stdout reporting to the specified instances (so non-matching instances will be filtered). An optional unit/scale is applicable for dimension-compatible, non-string, and (currently) non-raw metrics. (See below for supported unit/scale specifications.) By default, cumulative counter metrics are converted to rates. If the optional type field is set to raw then this rate conversion is disabled, unit/scale specification is (currently) ignored and raw values are reported instead. Finally, for supporting output targets (currently: stdout) a numeric width can be used to set the width of the output column for this metric. Too-wide numeric values for output will not be printed (apart from decimal places, numeric values will never be silently truncated). Too-wide strings will be truncated.

As a special case with metrics that are counters with time units (nanoseconds to hours), the unit/scale can be used to change the default reporting (for example, milliseconds / second) to normalize to the range zero to one by setting this to sec (see also -y).

The following metricspec requests the metric kernel.all.sysfork to be reported under the label forks, converting to the default rate count/s in an 8 wide column. Although the definitions in this compact form are optional, they must always be provided in the order specified above.

kernel.all.sysfork,forks,,,,8

The third form of a metricspec is described and valid only in pmrep.conf(5).

Performance metric values are retrieved from the set of Performance Co-Pilot (PCP) archive log files identified by the argument archive, which is a comma-separated list of names, each of which may be the base name of an archive or the name of a directory containing one or more archives. See also -u.

Unit/scale for space (byte) metrics, possible values include bytes, Kbytes, KB, Mbytes, MB, and so forth up to Ebytes, EB. This option will not override possible per-metric specifications. See also pmParseUnitsStr(3).

Specify the config file to use. The default is the first found of: ./pmrep.conf, $HOME/.pmrep.conf, $HOME/pcp/pmrep.conf, and $PCP_SYSCONF_DIR/pmrep/pmrep.conf. See pmrep.conf(5). Unlike with other options, config must be separated by a space from -c.

When replaying from an archive, this option requests that the prevailing real-time delay be applied between samples (see -t) to effect a pause, rather than the default behaviour of replaying at full speed.

Specify derived performance metrics. If derived starts with a slash (“/”) or with a dot (“.”) it will be interpreted as a derived metrics configuration file, otherwise it will be interpreted as comma-separated derived metric expressions. For details see pmLoadDerivedConfig(3) and pmRegisterDerived(3).

Use the format string for formatting the timestamp. The format will be used with Python's datetime.strftime method which is mostly the same as that described in strftime(3). An empty format string (i.e., '') will remove the timestamps from the output. The default with stdout is %H:%M:%S. The default with csv is %Y-%m-%d %H:%M:%S.

Report only the listed instances (if present). By default all current instances are reported. This is a global option that is used for all metrics unless a metric-specific instance definition is provided as part of a metricspec. Metrics without instances are reported as usual.

The list may consist of one or more comma-separated instances. The instance name may be quoted with single (') or double (") quotes for those cases where the instance name contains commas or white space. Note that on the command line when specifying more than one instance, all the names must be quoted.

Multiple -i options are allowed as an alternative way of specifying more than one instance of interest.

When fetching metrics from a local context (see -L), the -K option may be used to control the DSO PMDAs that should be made accessible. The spec argument conforms to the syntax described in __pmSpecLocalPMDA(3). More than one -K option may be used.

Use precision for numeric non-integer output values. If the value is too wide for its column width, precision is reduced one by one until the value fits, or not printed at all if it does not. The default is to use 3 decimal places (when applicable).

Unit/scale for count metrics, possible values include count x 10^-1, count, count x 10, count x 10^2, and so forth from 10^-8 to 10^7. (These values are currently space-sensitive.) This option will not override possible per-metric specifications. See also pmParseUnitsStr(3).

The argument samples defines the number of samples to be retrieved and reported. If samples is 0 or -s is not specified, pmrep will sample and report continuously (in real time mode) or until the end of the set of PCP archives (in archive mode). See also -T.

The default update interval may be set to something other than the default 1 second. The interval argument follows the syntax described in PCPIntro(1), and in the simplest form may be an unsigned integer (the implied units in this case are seconds). See also the -T and -u options.

When reporting archived metrics, the report will be restricted to those records logged before or at endtime. Refer to PCPIntro(1) for a complete description of the syntax for endtime.

When used to define the runtime before pmrep will exit, if no samples is given (see -s) then the number of reported samples depends on interval (see -t). If samples is given then interval will be adjusted to allow reporting of samples during runtime. In case all of -T, -s, and -t are given, endtime determines the actual time pmrep will run.

When reporting archived metrics, by default values are reported according to the selected sample interval (-t option), not according to the actual record interval in an archive. To this effect PCP interpolates the values to be reported based on the records in the archive. With the -u option uninterpolated reporting is enabled, every recorded value for the selected metrics is reported and the requested sample interval (-t) is ignored.

So for example, if a PCP archive contains recorded values for every 10 seconds and the requested sample interval is 1 hour, by default pmrep will use an interpolation scheme to compute the values of the requested metrics from the values recorded in the proximity of these requested metrics and values for every 1 hour are reported. With -u every record every 10 seconds are used as such (the reported values are still subject to rate conversion, use -r to disable).

Set the stdout output column width. Strings will be truncated to this width. The default width is the shortest that can fit the metric label, the forced minimum is 3. This option will not override possible per-metric specifications.

Swap columns and rows in stdout output, reporting one instance per line, using label as the label for instance column (set to an empty string "" to enable swapping without a specific label). This is convenient to allow easily using grep(1) to filter results or to more closely mimic other utilities. See also -i.

Unit/scale for time metrics, possible values include nanosec, ns, microsec, us, millisec, ms, and so forth up to hour, hr. This option will not override possible per-metric specifications. See also pmParseUnitsStr(3).

The following examples use the PCP facilities for collecting the metric values, no external utilities are needed. The examples expect the default configuration file to contain the metricset specifications.

Display network interface statistics on the local host:

$ pmrep network.interface.total.bytes

Display per-device disk reads and writes from the host server1 using two seconds interval and CSV output format:

Environment variables with the prefix PCP_ are used to parametrize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).