1PMREP(1) General Commands Manual PMREP(1)
2
3
4
6 pmrep - performance metrics reporter
7
9 pmrep [-12357CdgGHIjkLnprRuUvVxz?] [-4 action] [-6 sort-metric] [-8|-9
10 limit] [-a archive] [-A align] [--archive-folio folio] [-b|-B space-
11 scale] [-c config] [--container container] [--daemonize] [-e derived]
12 [-E lines] [-f format] [-F outfile] [-h host] [-i instances]
13 [--include-texts] [-J rank] [-K spec] [-l delimiter] [-N predicate] [-o
14 output] [-O origin] [-P|-0 precision] [-q|-Q count-scale] [-s samples]
15 [-S starttime] [-t interval] [-T endtime] [-w|-W width] [-X label]
16 [-y|-Y time-scale] [-Z timezone] metricspec [...]
17
19 pmrep is a customizable performance metrics reporting tool. Any avail‐
20 able performance metric, live or archived, system and/or application,
21 can be selected for reporting using one of the output alternatives
22 listed below together with applicable formatting options.
23
24 pmrep collects the selected metric values through the facilities of the
25 Performance Co-Pilot (PCP), see PCPIntro(1). The metrics to be
26 reported are specified on the command line, in a configuration file, or
27 both. Metrics can be automatically converted and scaled using the PCP
28 facilities, either by default or by per-metric scaling specifications.
29 In addition to the existing metrics, derived metrics can be defined
30 using the arithmetic expressions described in pmRegisterDerived(3).
31
32 Unless directed to another host by the -h option, pmrep will contact
33 the Performance Metrics Collector Daemon (PMCD, see pmcd(1)) on the
34 local host.
35
36 The -a option causes pmrep to use the specified set of archive logs
37 rather than connecting to a PMCD. The -a and -h options are mutually
38 exclusive.
39
40 The -L option causes pmrep to use a local context to collect metrics
41 from DSO PMDAs (Performance Metrics Domain Agents, ``plugins'') on the
42 local host without PMCD. Only some metrics are available in this mode.
43 The -a, -h, and -L options are mutually exclusive.
44
45 The metrics of interest are named in the metricspec argument(s). If a
46 metricspec specifies a non-leaf node in the Performance Metrics Name
47 Space (PMNS), then pmrep will recursively descend the PMNS and report
48 on all leaf nodes (i.e., metrics) for that metricspec. (Use for exam‐
49 ple pminfo(1) to list all the leaf nodes and their descriptions.)
50
51 A metricspec has three different forms. First, on the command line it
52 can start with a colon (``:'') to indicate a metricset to be read from
53 a pmrep configuration file (see pmrep.conf(5)) which can then consist
54 of any number of metricspecs. Second, a metricspec starting with non-
55 colon specifies a PMNS node as described above, optionally followed by
56 metric formatting definitions. This so-called compact form of a met‐
57 ricspec is defined as follows:
58
59 metric[,label[,instances[,unit/scale[,type[,width[,precision[,limit]]]]]]]
60
61 A valid PMNS node (metric) is mandatory. It can be followed by a text
62 label used by supporting output targets (currently: stdout, see below).
63 The optional instances definition restricts csv and stdout reporting to
64 the specified instances (so non-matching instances will be filtered).
65 An optional unit/scale is applicable for dimension-compatible, non-
66 string metrics. (See below for supported unit/scale specifications.)
67 By default, cumulative counter metrics are converted to rates, an
68 optional type can be set to raw to disable this rate conversion. For
69 supporting output targets (currently: stdout) a numeric width can be
70 used to set the width of the output column for this metric. Too-wide
71 numeric values for output will not be printed (apart from trailing dec‐
72 imals, numeric values will never be silently truncated). Too-wide
73 strings will be truncated. Then, a metric-specific precision can be
74 provided for numeric non-integer output values. Lastly, a metric-spe‐
75 cific limit can be set for filtering numeric values per limit.
76
77 As a special case with metrics that are counters with time units
78 (nanoseconds to hours), the unit/scale can be used to change the
79 default reporting (for example, milliseconds / second) to normalize to
80 the range zero to one by setting this to sec (see also -y and -Y).
81
82 The following metricspec requests the metric kernel.all.sysfork to be
83 reported under the text label forks, converting to the default rate
84 count/s in an 8 wide column. Although the definitions in this compact
85 form are optional, they must always be provided in the order specified
86 above.
87
88 kernel.all.sysfork,forks,,,,8
89
90 The third form of a metricspec, verbose form, is described and valid
91 only in pmrep.conf(5).
92
93 Derived metrics are specified like PMNS leaf node metrics.
94
95 Options via environment values (see pmGetOptions(3)) override the cor‐
96 responding built-in default values (if any). Configuration file
97 options override the corresponding environment variables (if any).
98 Command line options override the corresponding configuration file
99 options (if any).
100
102 The available command line options are:
103
104 -0 precision, --precision-force=precision
105 Like -P but this option will override per-metric specifications.
106
107 -1, --dynamic-header
108 Print a new dynamically adjusted header every time changes in
109 availability of metric and instance values occur. By default a
110 static header that never changes is printed once. See also -4,
111 -7, and -E.
112
113 -2, --overall-rank
114 Perform overall ranking of instances in archive. By default rank‐
115 ing (see -J) and reporting happens on each interval. With this
116 option all instances and values are ranked before a summary is
117 reported. See pmlogsummary(1) for further archive summary report‐
118 ing alternatives, including averages and peak times for values.
119
120 -3, --overall-rank-alt
121 Like -2 but print metric instances in pmrep metricspec format, to
122 allow easily selecting the instances for further investigation.
123
124 -4 action, --names-change=action
125 Specify which action to take on receiving a metric names change
126 event during sampling. These events occur when a PMDA discovers
127 new metrics sometime after starting up, and informs running client
128 tools like pmrep. Valid values for action are update (refresh
129 metrics being sampled), ignore (do nothing - the default behav‐
130 iour) and abort (exit the program if such an event happens).
131 update implies --dynamic-header.
132
133 -5, --ignore-unknown
134 Silently ignore any metric name that cannot be resolved. At least
135 one metric must be found for the tool to start.
136
137 -6, --sort-metric=sort-metric
138 Specify a sort reference metric to sort output by values with -X.
139 By default sorting order is descending, prepending the metric name
140 with the minus sign (``-'') will change the order to be ascending.
141 See also -J and -N.
142
143 -7, --fixed-header
144 With -X print a fixed header once (unless using -E) including all
145 metrics being reported. Unlike with the default (static) header,
146 only instances with values available are reported. Unlike with
147 the dynamic header, the header is not updated even if values for
148 some metrics later become (un)available. See also -1 and -E.
149
150 -8 limit, --limit-filter=limit
151 Limit results to instances with values above/below limit. A posi‐
152 tive integer will include instances with values at or above the
153 limit in reporting. A negative integer will include instances
154 with values at or below the limit in reporting. A value of zero
155 performs no limit filtering. This option will not override possi‐
156 ble per-metric specifications. See also -J and -N.
157
158 -9 limit, --limit-filter-force=limit
159 Like -8 but this option will override per-metric specifications.
160
161 -a archive, --archive=archive
162 Performance metric values are retrieved from the set of Perfor‐
163 mance Co-Pilot (PCP) archive log files identified by the archive
164 argument, which is a comma-separated list of names, each of which
165 may be the base name of an archive or the name of a directory con‐
166 taining one or more archives. See also -u.
167
168 -A align, --align=align
169 Force the initial sample to be aligned on the boundary of a natu‐
170 ral time unit align. Refer to PCPIntro(1) for a complete descrip‐
171 tion of the syntax for align.
172
173 --archive-folio=folio
174 Read metric source archives from the PCP archive folio created by
175 tools like pmchart(1) or, less often, manually with mkaf(1).
176
177 -b scale, --space-scale=scale
178 Unit/scale for space (byte) metrics, possible values include
179 bytes, Kbytes, KB, Mbytes, MB, and so forth. This option will not
180 override possible per-metric specifications. See also pmParseU‐
181 nitsStr(3).
182
183 -B scale, --space-scale-force=scale
184 Like -b but this option will override per-metric specifications.
185
186 -c config, --config=config
187 Specify the config file to use. The default is the first found
188 of: ./pmrep.conf, $HOME/.pmrep.conf, $HOME/pcp/pmrep.conf, and
189 $PCP_SYSCONF_DIR/pmrep/pmrep.conf. See pmrep.conf(5).
190
191 --container=container
192 Fetch performance metrics from the specified container, either
193 local or remote (see -h).
194
195 -C, --check
196 Exit before reporting any values, but after parsing the configura‐
197 tion and metrics and printing possible headers.
198
199 -d, --delay
200 When replaying from an archive, this option requests that the pre‐
201 vailing real-time delay be applied between samples (see -t) to
202 effect a pause, rather than the default behaviour of replaying at
203 full speed.
204
205 --daemonize
206 Daemonize on startup.
207
208 -e derived, --derived=derived
209 Specify derived performance metrics. If derived starts with a
210 slash (``/'') or with a dot (``.'') it will be interpreted as a
211 derived metrics configuration file, otherwise it will be inter‐
212 preted as comma- or semicolon-separated derived metric expres‐
213 sions. For details see pmLoadDerivedConfig(3) and pmRegister‐
214 Derived(3).
215
216 -E lines, --repeat-header=lines
217 Repeat the header every lines of output. See also -1 and -7.
218
219 -f format, --timestamp-format=format
220 Use the format string for formatting the timestamp. The format
221 will be used with Python's datetime.strftime method which is
222 mostly the same as that described in strftime(3). An empty format
223 string (i.e., "") will remove the timestamps from the output.
224 Defaults to %H:%M:%S when using the stdout output target.
225 Defaults to %Y-%m-%d %H:%M:%S when using the csv output target.
226
227 -F outfile, --output-file=outfile
228 Specify the output file outfile. See -o.
229
230 -g, --separate-header
231 Output the column number and complete metric information, one-per-
232 line, before printing the metric values.
233
234 -G, --no-globals
235 Do not include global metrics in reporting (see pmrep.conf(5)).
236
237 -h host, --host=host
238 Fetch performance metrics from pmcd(1) on host, rather than from
239 the default localhost.
240
241 -H, --no-header
242 Do not print any headers.
243
244 -i instances, --instances=instances
245 Report only the listed instances from current instances (if
246 present, see also -j). By default all current instances are
247 reported, except when writing an archive (see -o) when all
248 instances, present and future, are reported. This is a global
249 option that is used for all metrics unless a metric-specific
250 instance definition is provided as part of a metricspec. By
251 default single-valued ``flat'' metrics without multiple instances
252 are still reported as usual, use -v to change this.
253
254 The list may consist of one or more comma-separated instances.
255 The instance name may be quoted with single (') or double (")
256 quotes for those cases where the instance name contains commas or
257 whitespace. Note that on the command line when specifying more
258 than one instance, all the names must be quoted.
259
260 Multiple -i options are allowed as an alternative way of specify‐
261 ing more than one instance of interest. Regular expressions can
262 also be used.
263
264 As an example, the following would report the same instances:
265
266 $ pmrep -i "'1 minute','5 minute'" kernel.all.load
267 $ pmrep -i '"1 minute","5 minute"' kernel.all.load
268 $ pmrep -i "'1 minute'" -i "'5 minute'" kernel.all.load
269 $ pmrep kernel.all.load,,"'1 minute','5 minute'"
270 $ pmrep kernel.all.load,,'"1 minute","5 minute"'
271
272
273 However, this would report only the 1-minute instance:
274
275 $ pmrep -i '"1 minute","5 minute"' kernel.all.load,,"1 minute"
276
277
278 But this would report all instances (due to per-metric override):
279
280 $ pmrep -i '"1 minute","5 minute"' 'kernel.all.load,,.*'
281
282
283 -I, --ignore-incompat
284 Ignore incompatible metrics. By default incompatible metrics
285 (that is, their type is unsupported or they cannot be scaled as
286 requested) will cause pmrep to terminate with an error message.
287 With this option all incompatible metrics are silently omitted
288 from reporting. This may be especially useful when requesting
289 non-leaf nodes of the PMNS tree for reporting.
290
291 --include-texts
292 When writing a PCP archive, include PCP metric help texts in the
293 created archive.
294
295 -j, --live-filter
296 Perform instance live filtering. This allows capturing all fil‐
297 tered instances even if processes are restarted at some point
298 (unlike without live filtering). Performing live filtering over a
299 huge amount of instances will add some internal overhead so a bit
300 of user caution is advised. See also -1 and -n.
301
302 -J rank, --rank=rank
303 Limit results to highest/lowest ranked instances of set-valued
304 metrics. A positive integer will include highest valued instances
305 in reporting. A negative integer will include lowest valued
306 instances in reporting. A value of zero performs no ranking.
307 Ranking does not imply sorting, see -6. See also -2 and -8.
308
309 -k, --extended-csv
310 Write extended CSV output, similar to sadf(1).
311
312 -K spec, --spec-local=spec
313 When fetching metrics from a local context (see -L), the -K option
314 may be used to control the DSO PMDAs that should be made accessi‐
315 ble. The spec argument conforms to the syntax described in
316 pmSpecLocalPMDA(3). More than one -K option may be used.
317
318 -l delimiter, --delimiter=delimiter
319 Specify the delimiter that separates each column of csv or stdout
320 output. The default for stdout is two spaces (`` '') and comma
321 (``,'') for csv. In case of CSV output or stdout output with non-
322 whitespace delimiter, any instances of the delimiter in string
323 values will be replaced by the underscore (``_'') character.
324
325 -L, --local-PMDA
326 Use a local context to collect metrics from DSO PMDAs on the local
327 host without PMCD. See also -K.
328
329 -n, --invert-filter
330 Perform ranking before live filtering. By default instance live
331 filtering (when requested, see -j) happens before instance ranking
332 (when requested, see -J). With this option the logic is inverted
333 and ranking happens before live filtering.
334
335 -N predicate, --predicate=predicate
336 Specify a comma-separated list of predicate filter reference met‐
337 rics. By default ranking (see -J) happens for each metric indi‐
338 vidually. With predicates, ranking is done only for the specified
339 predicate metrics. When reporting, rest of the metrics sharing
340 the same instance domain (see PCPIntro(1)) as the predicate will
341 include only the highest/lowest ranking instances of the corre‐
342 sponding predicate. Ranking does not imply sorting, see -6.
343
344 So for example, using proc.memory.rss (resident memory size of
345 process) as the predicate metric together with proc.io.total_bytes
346 and mem.util.used as metrics to be reported, only the processes
347 using most/least (as per -J) memory will be included when report‐
348 ing total bytes written by processes. Since mem.util.used is a
349 single-valued metric (thus not sharing the same instance domain as
350 the process-related metrics), it will be reported as usual.
351
352 -o output, --output=output
353 Use output target for reporting. The default target is stdout.
354 The available target alternatives are:
355
356 archive
357 Record metrics into a PCP archive which can later be replayed
358 with PCP tools, including pmrep itself. See LOGARCHIVE(5) and
359 PCPIntro(1) for details about PCP archive files. Requires -F.
360
361 csv
362 Print metrics in CSV format (subject to formatting options).
363
364 stdout
365 Print metrics to stdout (format subject to formatting options).
366
367 -O origin, --origin=origin
368 When reporting archived metrics, start reporting at origin within
369 the time window (see -S and -T). Refer to PCPIntro(1) for a com‐
370 plete description of the syntax for origin.
371
372 -p, --timestamps
373 Print timestamps. By default no timestamps are printed.
374
375 -P precision, --precision=precision
376 Use precision for numeric non-integer output values. If the value
377 is too wide for its column width, precision is reduced one by one
378 until the value fits, or not printed at all if it does not. The
379 default is to use 3 decimal places (when applicable). This option
380 will not override possible per-metric specifications.
381
382 -q scale, --count-scale=scale
383 Unit/scale for count metrics, possible values include count x
384 10^-1, count, count x 10, count x 10^2, and so forth from 10^-8 to
385 10^7. (These values are currently space-sensitive.) This option
386 will not override possible per-metric specifications. See also
387 pmParseUnitsStr(3).
388
389 -Q scale, --count-scale-force=scale
390 Like -q but this option will override per-metric specifications.
391
392 -r, --raw
393 Output raw metric values, do not convert cumulative counters to
394 rates. When writing archives, raw values are always used. This
395 option will override possible per-metric specifications.
396
397 -R, --raw-prefer
398 Like -r but this option will not override per-metric specifica‐
399 tions.
400
401 -s samples, --samples=samples
402 The samples argument defines the number of samples to be retrieved
403 and reported. If samples is 0 or -s is not specified, pmrep will
404 sample and report continuously (in real time mode) or until the
405 end of the set of PCP archives (in archive mode). See also -T.
406
407 -S starttime, --start=starttime
408 When reporting archived metrics, the report will be restricted to
409 those records logged at or after starttime. Refer to PCPIntro(1)
410 for a complete description of the syntax for starttime.
411
412 -t interval, --interval=interval
413 Set the reporting interval to something other than the default 1
414 second. The interval argument follows the syntax described in
415 PCPIntro(1), and in the simplest form may be an unsigned integer
416 (the implied units in this case are seconds). See also the -T and
417 -u options.
418
419 -T endtime, --finish=endtime
420 When reporting archived metrics, the report will be restricted to
421 those records logged before or at endtime. Refer to PCPIntro(1)
422 for a complete description of the syntax for endtime.
423
424 When used to define the runtime before pmrep will exit, if no sam‐
425 ples is given (see -s) then the number of reported samples depends
426 on interval (see -t). If samples is given then interval will be
427 adjusted to allow reporting of samples during runtime. In case
428 all of -T, -s, and -t are given, endtime determines the actual
429 time pmrep will run.
430
431 -u, --no-interpol
432 When reporting archived metrics, by default values are reported
433 according to the selected sample interval (-t option), not accord‐
434 ing to the actual record interval in an archive. To this effect
435 PCP interpolates the values to be reported based on the records in
436 the archive. With the -u option uninterpolated reporting is
437 enabled, every recorded value for the selected metrics is reported
438 and the requested sample interval (-t) is ignored.
439
440 So for example, if a PCP archive contains recorded values for
441 every 10 seconds and the requested sample interval is 1 hour, by
442 default pmrep will use an interpolation scheme to compute the val‐
443 ues of the requested metrics from the values recorded in the prox‐
444 imity of these requested metrics and values for every 1 hour are
445 reported. With -u every record every 10 seconds are reported as
446 such (the reported values are still subject to rate conversion,
447 use -r or -R to disable).
448
449 -U, --no-unit-info
450 Omit unit information from headers.
451
452 -v, --omit-flat
453 Omit single-valued ``flat'' metrics from reporting, only consider
454 set-valued metrics (i.e., metrics with multiple values) for
455 reporting. See -i and -I.
456
457 -V, --version
458 Display version number and exit.
459
460 -w width, --width=width
461 Set the stdout output column width. Strings will be truncated to
462 this width. The default width is the shortest that can fit the
463 metric text label, the forced minimum is 3. This option will not
464 override possible per-metric specifications.
465
466 -W width, --width-force=width
467 Like -w but this option will override per-metric specifications.
468
469 -x, --extended-header
470 Print extended header.
471
472 -X label, --colxrow=label
473 Swap columns and rows in stdout output, reporting one instance per
474 line, using label as the text label for instance column (set to an
475 empty string "" to enable swapping without a specific text label).
476 This is convenient to allow easily using grep(1) to filter results
477 or to more closely mimic other utilities. See also -i and -6.
478
479 -y scale, --time-scale=scale
480 Unit/scale for time metrics, possible values include nanosec, ns,
481 microsec, us, millisec, ms, and so forth up to hour, hr. This
482 option will not override possible per-metric specifications. See
483 also pmParseUnitsStr(3).
484
485 -Y scale, --time-scale-force=scale
486 Like -y but this option will override per-metric specifications.
487
488 -z, --hostzone
489 Use the local timezone of the host that is the source of the per‐
490 formance metrics, as identified by either the -h or the -a
491 options. The default is to use the timezone of the local host.
492
493 -Z timezone, --timezone=timezone
494 Use timezone for the date and time. Timezone is in the format of
495 the environment variable TZ as described in environ(7). Note that
496 when including a timezone string in output, ISO 8601 -style UTC
497 offsets are used (so something like -Z EST+5 will become UTC-5).
498
499 -?, --help
500 Display usage message and exit.
501
503 The following examples use the standard PCP facilities for collecting
504 the metric values, no external utilities are needed. The referenced
505 colon-starting metricsets are part of the system pmrep.conf file.
506
507 Display network interface metrics on the local host:
508 $ pmrep network.interface.total.bytes
509
510 Display all outgoing network metrics for the wlan0 interface:
511 $ pmrep -i wlan0 -v network.interface.out
512
513 Display timestamped vmstat(8) like information using megabytes instead
514 of kilobytes and also include the number of inodes used (tab completes
515 available metrics and after a colon metricsets with bash and zsh):
516 $ pmrep -p -B MB :vmstat vfs.inodes.count
517
518 Display per-device disk reads and writes from the host server1 using
519 two seconds interval and sadf(1) like CSV output format:
520 $ pmrep -h server1 -t 2s -o csv -k disk.dev.read disk.dev.write
521
522 Display processes using at least 100MB of memory using dynamic headers:
523 $ pmrep -b MB --limit-filter 100 --dynamic-header proc.memory.rss
524
525 Display the predefined set of metrics from the default pmrep.conf(5)
526 containing information about I/O issued by current firefox process(es):
527 $ pmrep -i '.*firefox.*' :proc-io
528
529 Display the three most CPU-using processes:
530 $ pmrep -1gUJ 3 proc.hog.cpu
531
532 Display sar -w and sar -W like information at the same time from the
533 PCP archive ./20150921.09.13 showing values recorded between 3 - 5 PM:
534 $ pmrep -a ./20150921.09.13 -S @15:00 -T @17:00 :sar-w :sar-W
535
536 Record most relevant CPU, memory, and I/O related information about
537 every Java process on the system, present and future, to an archive ./a
538 on one minute interval at every full minute in a background process:
539 $ pmrep --daemonize -A 1m -t 1m -i '.*java.*' -j -o archive -F ./a \
540 :proc-info :proc-cpu :proc-mem :proc-io
541
542 Record all 389 Directory Server, XFS file system, and CPU/memory/disk
543 metrics every five seconds for five minutes to a PCP archive ./a:
544 $ pmrep -t 5s -T 5m -o archive -F ./a ds389 xfs kernel.all.cpu mem disk
545
546 Record process memory and I/O information for those processes which are
547 the three most memory-consuming processes:
548 $ pmrep -o archive -F ./a -J 3 -N proc.memory.rss proc.memory proc.io
549
551 pmrep.conf
552 pmrep configuration file (see -c)
553
554 $PCP_SYSCONF_DIR/pmrep/pmrep.conf
555 system provided pmrep configuration file
556
558 Environment variables with the prefix PCP_ are used to parameterize the
559 file and directory names used by PCP. On each installation, the file
560 /etc/pcp.conf contains the local values for these variables. The
561 $PCP_CONF variable may be used to specify an alternative configuration
562 file, as described in pcp.conf(5).
563
564 For environment variables affecting PCP tools, see pmGetOptions(3).
565
567 mkaf(1), PCPIntro(1), pcp(1), pcp-atop(1), pcp2elasticsearch(1),
568 pcp2graphite(1), pcp2influxdb(1), pcp2json(1), pcp2spark(1),
569 pcp2xlsx(1), pcp2xml(1), pcp2zabbix(1), pmcd(1), pmchart(1), pmdiff(1),
570 pmdumplog(1), pmdumptext(1), pminfo(1), pmiostat(1), pmlogextract(1),
571 pmlogsummary(1), pmprobe(1), pmstat(1), pmval(1), sadf(1), sar(1),
572 pmGetOptions(3), pmSpecLocalPMDA(3), pmLoadDerivedConfig(3), pmParseU‐
573 nitsStr(3), pmRegisterDerived(3), strftime(3), LOGARCHIVE(5),
574 pcp.conf(5), PMNS(5), pmrep.conf(5), environ(7) and vmstat(8).
575
576
577
578Performance Co-Pilot PCP PMREP(1)