pmrep man page
pmrep — performance metrics reporter
pmrep [-CdGHILpruUvVxz?] [-a archive] [--archive-folio folio] [-A align] [-b space-scale] [-c config] [--container container] [-e derived] [-E lines] [-f format] [-F outfile] [-h host] [-i instances] [-K spec] [-l delimiter] [-o output] [-O origin] [-P precision] [-q count-scale] [-s samples] [-S starttime] [-t interval] [-T endtime] [-w width] [-X label] [-y time-scale] [-Z timezone] metricspec [...]
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:
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.
The third form of a metricspec is described and valid only in pmrep.conf(5).
Derived metrics are specified like PMNS leaf node metrics.
Configuration file options override the corresponding built-in default values (if any). Command line options override the corresponding configuration file options (if any).
Command Line Options
The available command line options are:
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.
Read metric source archives from the PCP archive folio (see mkaf(1)).
When reporting archived metrics, force the initial sample to be aligned on the boundary of a natural time unit align. Refer to PCPIntro(1) for a complete description of the syntax for align.
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).
Fetch performance metrics from the specified container, either local or remote (see -h).
Exit before reporting any values, but after parsing the configuration and metrics and printing possible headers.
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).
Repeat the header every lines of output.
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.
Specify the output file outfile. See -o.
Do not include global metrics in reporting (see pmrep.conf(5)).
Fetch performance metrics from pmcd(1) on host, rather than the default localhost.
Do not print any headers.
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. By default metrics without instances are reported as usual, use -v to change this.
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.
As an example, the following would report the same instances:
$ pmrep -i "'1 minute','5 minute'" kernel.all.load $ pmrep -i '"1 minute","5 minute"' kernel.all.load $ pmrep -i "'1 minute'" -i "'5 minute'" kernel.all.load $ pmrep kernel.all.load,,"'1 minute','5 minute'" $ pmrep kernel.all.load,,'"1 minute","5 minute"'
However, this would report only the 1-minute instance:
$ pmrep -i '"1 minute","5 minute"' kernel.all.load,,"1 minute"
Ignore incompatible metrics. By default incompatible metrics (that is, their type is unsupported or they cannot be scaled as requested) will cause pmrep to terminate with an error message. With this option all incompatible metrics are silently omitted from reporting. This may be especially useful when requesting non-leaf nodes of the PMNS tree for reporting.
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.
Specify the delimiter that separates each column of csv or stdout output. The delimiter may only be a single character. The default for stdout is two spaces (“ ”) and comma (“,”) for csv.
Use a local context to collect metrics from DSO PMDAs on the local host without PMCD. See also -K.
Use output target for reporting. The default target is stdout. The available target alternatives are:
Record metrics into a PCP archive which can later be replayed with PCP tools, including pmrep itself. See pcp-archive(5) and PCPIntro(1) for details about PCP archive files. Requires -F.
Print metrics in CSV format (subject to formatting options).
Print metrics to stdout (format subject to formatting options).
Send metrics to a Zabbix server. See pmrep.conf(5) for the needed Zabbix configuration options. This target is currently experimental.
When reporting archived metrics, start reporting at origin within the time window (see -S and -T). Refer to PCPIntro(1) for a complete description of the syntax for origin.
Print timestamps. By default no timestamps are printed.
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).
Output raw metric values, do not convert cumulative counters to rates. This option will override possible per-metric specifications.
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.
When reporting archived metrics, the report will be restricted to those records logged at or after starttime. Refer to PCPIntro(1) for a complete description of the syntax for starttime.
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).
Omit unit information from of headers.
Omit single-valued “flat” metrics from reporting when instances were requested. See -i and -I.
Display version number and exit.
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.
Print extended header.
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).
Use the local timezone of the host that is the source of the performance metrics, as identified by either the -h or the -a options. The default is to use the timezone of the local host.
Use timezone when displaying the date and time. Timezone is in the format of the environment variable TZ as described in environ(7).
Display usage message and exit.
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 metrics on the local host:
$ pmrep network.interface.total.bytes
Display all outgoing network metrics for the wlan0 interface:
$ pmrep -i wlan0 -v network.interface.out
Display per-device disk reads and writes from the host server1 using two seconds interval and CSV output format:
$ pmrep -h server1 -o csv -t 2s disk.dev.read disk.dev.write
Display timestamped vmstat(8) like information using MBs instead of bytes and also include the number of in-use inodes:
$ pmrep -p -b MB vfs.inodes.count :vmstat
Display sar -w and sar -W like information at the same time from the PCP archive ./20150921.09.13 showing values recorded between 3 - 5 PM:
$ pmrep -a ./20150921.09.13 -S @15:00 -T @17:00 :sar-w :sar-W
Record all 389 Directory Server, XFS file system and CPU/disk/memory related metrics every five seconds for the next five minutes to the PCP archive ./a:
$ pmrep -o archive -F ./a -t 5s -T 5m ds389 xfs kernel.all.cpu disk mem
pmrep configuration file (see -c).
System provided configuration file.
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).
mkaf(1), PCPIntro(1), pcp(1), pcp-atop(1), pmcd(1), pmchart(1), pmcollectl(1), pmdiff(1), pmdumplog(1), pmdumptext(1), pminfo(1), pmiostat(1), pmlogextract(1), pmlogsummary(1), pmprobe(1), pmstat(1), pmval(1), sar(1), __pmSpecLocalPMDA(3), pmLoadDerivedConfig(3), pmParseUnitsStr(3), pmRegisterDerived(3), strftime(3), pcp-archive(5), pcp.conf(5), pmns(5), pmrep.conf(5), environ(7) and vmstat(8).
parfait(1), pcp-collectl(1), PCPIntro(1), pmcd(1), pmchart(1), pmclient(1), pmdumptext(1), pmevent(1), pminfo(1), pmlogsummary(1), pmmgr(1), pmrep.conf(5), zbxpcp(3).