1PMSERIES(1) General Commands Manual PMSERIES(1)
2
3
4
6 pmseries - display information about performance metric timeseries
7
9 pmseries [-adFiIlLmMnqsStvV?] [-c config] [-g pattern] [-h host] [-p
10 port] [-Z timezone] [query | labels ... | series ... | source ... ]
11
13 pmseries displays various types of information about performance met‐
14 rics available through the scalable timeseries facilities of the Per‐
15 formance Co-Pilot (PCP) and the Redis distributed data store.
16
17 By default pmseries communicates with a local redis-server(1), however
18 the -h and -p options can be used to specify an alternate Redis in‐
19 stance. If this instance is a node of a Redis cluster, all other in‐
20 stances in the cluster will be discovered and used automatically.
21
22 pmseries runs in several different modes - either querying timeseries
23 identifiers, metadata or values (already stored in Redis), or manually
24 loading timeseries into Redis. The latter mode is seldom used, how‐
25 ever, since pmproxy(1) will automatically perform this function for lo‐
26 cal pmlogger(1) instances, when running in its default time series
27 mode.
28
29 Without command line options specifying otherwise, pmseries will issue
30 a timeseries query to find matching timeseries and values. All time‐
31 series are identified using a unique SHA-1 hash which is always dis‐
32 played in a 40-hexdigit human readable form. These hashes are formed
33 using the metadata associated with every metric.
34
35 Importantly, this includes all metric metadata (labels, names, descrip‐
36 tors). Metric labels in particular are (as far as possible) unique for
37 every machine - on Linux for example the labels associated with every
38 metric include the unique /etc/machine-id, the hostname, domainname,
39 and other automatically generated machine labels, as well as any admin‐
40 istrator-defined labels from /etc/pcp/labels. These labels can be re‐
41 ported with pminfo(1) and the pmcd.labels metric.
42
43 See pmLookupLabels(3), pmLookupInDom(3), pmLookupName(3) and pm‐
44 LookupDesc(3) for detailed information about metric labels and other
45 metric metadata used in each timeseries identifier hash calculation.
46
47 The timeseries identifiers provide a higher level (and machine indepen‐
48 dent) identifier than the traditional PCP performance metric identi‐
49 fiers (pmID), instance domain identifiers (pmInDom) and metric names.
50 See PCPIntro(1) for more details about these traditional identifiers.
51 However, pmseries uses timeseries identifiers in much the same way that
52 pminfo(1) uses the lower level indom, metric identifiers and metric
53 names.
54
55 The default mode of pmseries operation (i.e. with no command line op‐
56 tions) depends on the arguments it is presented. If all non-option ar‐
57 guments appear to be timeseries identifiers (in 40 hex digit form) pm‐
58 series will report metadata for these timeseries - refer to the -a op‐
59 tion for details. Otherwise, the parameters will be treated as a time‐
60 series query.
61
63 Query expressions are formed using the pmseries query language de‐
64 scribed below, but can be as simple as a metric name.
65
66 The following is an example of querying timeseries from all hosts that
67 match a metric name pattern (globbed):
68
69 $ pmseries kernel.all.cpu*
70 1d7b0bb3f6aec0f49c54f5210885464a53629b60
71 379db729afd63fb9eff436625bd6c55a7adc5cfd
72 3dd3b45bb05f96636043e5d58b52b441ce542285
73 [...]
74 ed2bf325ff6dc7589ec966698e5404b67252306a
75 dcb2a032a308b5717bf605ba8f8737e9c6e1ed19
76
77 To identify timeseries expression operands, the query language uses the
78 general syntax:
79
80 [metric.name] '{metadata qualifiers}' '[time specification]'
81
82 The metric.name component restricts the timeseries query to any match‐
83 ing PCP metric name (the list of metric names for a PCP archive or live
84 host is reported by pminfo(1) with no arguments beyond --host or --ar‐
85 chive). The pmseries syntax extends on that of pminfo and allows for
86 glob(7) based pattern matching within the metric name. The above de‐
87 scribes operands available as the leaves of pmseries expressions, which
88 may include functions, arithmetic operators and other features. See
89 the EXPRESSIONS section below for further details.
90
92 Metadata qualifiers are enclosed by ``curly'' braces ({}), and further
93 restrict the query results to timeseries operands with various metadata
94 properties. These qualifiers are based on metric or instance names,
95 and metric label values, and take the general form metadata.name OPERA‐
96 TOR value, such as:
97
98 instance.name == "cpu0"
99 metric.name != "kernel.all.pswitch"
100
101 When using label names, the metadata qualifier is optional and can be
102 dropped, such as:
103
104 label.hostname == "www.acme.com"
105 hostname == "www.acme.com"
106
107 For metric and instance names only the string operators apply, but for
108 metric label values all operators are available. The set of available
109 operators is:
110
111 Boolean operators
112 All string (label, metrics and instances) and numeric (label) values
113 can be tested for equality ("==") or inequality ("!=").
114
115 String operators
116 Strings can be subject to pattern matching in the form of glob matching
117 ("~~"), regular expression matching ("=~"), and regular expression non-
118 matching ("!~"). The ":" operator is equivalent to "~~" - i.e., glob
119 matching.
120
121 Relational operators (numeric label values only)
122 Numeric label values can be subject to the less than ("<"), greater
123 than (">"), less than or equal ("<="), greater than or equal (">="),
124 equal ("==") and not equal ("!=") operators.
125
126 Logical operators
127 Multiple metadata qualifiers can be combined with the logical operators
128 for AND ("&&") and OR ("||") as in many programming languages. The
129 comma (",") character is equivalent to logical AND ("&&").
130
132 The final (optional) component of a query allows the user to specify a
133 specific time window of interest. Any time specification will result
134 in values being returned for all matching timeseries only for the time
135 window specified.
136
137 The specification is ``square'' bracket ([]) enclosed, and consists of
138 one or more comma-separated components. Each component specifies some
139 aspect related to time, taking the general form: keyword: value, such
140 as:
141
142 samples:10
143
144 Sample count
145 The number of samples to return, specified via either the samples or
146 (equivalent) count keyword. The value provided must be a positive in‐
147 teger. If no end time is explicitly set (see ``Time window'' later)
148 then the most recent samples will be returned.
149
150 Sample interval
151 An interval between successive samples can be requested using the in‐
152 terval or (equivalent) delta keyword. The value provided should be ei‐
153 ther a numeric or string value that will be parsed by pmParseInter‐
154 val(3), such as 5 (seconds) or 2min (minutes).
155
156 Time window
157 Start and end times, and alignments, affecting the returned values.
158 The keywords match the parameters to the pmParseTimeWindow(3) function
159 which will be used to parse them, and are: start or (equivalent) begin,
160 finish or (equivalent) end, align and offset.
161
162 Time zones
163 The resulting timestamps can be returned having been evaluated for a
164 specific timezone, using the timezone or hostzone keywords. The value
165 associated with timezone will be interpreted by pmNewZone(3). A true
166 or false value should be associated with hostzone, and when set to true
167 this has the same effect as described by pmNewContextZone(3).
168
170 As described above, operands are the leaves of a query expression tree.
171
172 [metric.name] '{metadata qualifiers}' '[time specification]'
173 Note in most of the query expression examples below, the metadata qual‐
174 ifiers have been omitted for brevity. In all cases, multiple time se‐
175 ries may qualify, particularly for the hostname label.
176
177 In the simple case, a query expression consists of a single operand and
178 may just be a metric name. In the more general case, a query expres‐
179 sion is either an operand or the argument to a function, or two oper‐
180 ands in a binary arithmetic or logical expression. Most functions take
181 a single argument (an expression), though some require additional argu‐
182 ments, e.g. rescale.
183
184 operand | expr operator expr | func(expr[, arg])
185
186 This grammar shows expressions may be nested, e.g. using the addition
187 (+) operator as an example,
188
189 func1(func2(expr))
190 func1(expr) + func2(expr)
191 expr + func(expr)
192 func(expr) + expr
193 expr + expr
194
195 Rules governing compatibility of operands in an expression generally
196 depend on the function and/or operators and are described below indi‐
197 vidually. An important rule is that if any time windows are specified,
198 then all operands must cover the same number of samples, though the
199 time windows may differ individually. If no time windows or sample
200 counts are given, then pmseries will return a series identifier (SID)
201 instead of a series of timestamps and values. This SID may be used in
202 subsequent /series/values?series=SID RESTAPI calls, along with a spe‐
203 cific time window.
204
205 Arithmetic Operators
206 pmseries support addition, subtraction, division and multiplication on
207 each value in the time series of a binary pair of operands. No unary
208 or ternary operators are supported (yet). In all cases, the instance
209 domain and the number of samples of time series operands must be the
210 same. The metadata (units and dimensions) must also be compatible.
211 Depending on the function, the result will usually have the same in‐
212 stance domain and (unless noted otherwise), the same units as the oper‐
213 ands. The metadata dimensions (space, time, count) of the result may
214 differ (see below).
215
216 Expression operands may have different qualifiers, e.g. you can perform
217 binary arithmetic on metrics qualified by different labels (such as
218 hostname), or metric names. For example, to add the two most recent
219 samples of the process context switch (pswitch) counter metric for
220 hosts node88 and node89, and then perform rate conversion:
221
222 $ pmseries 'rate(kernel.all.pswitch{hostname:node88}[count:2] +
223 kernel.all.pswitch{hostname:node89}[count:2])'
224 1cf1a85d5978640ef94c68264d3ae8866cc11f7c
225 [Tue Nov 10 14:39:48.771868000 2020] 71.257509 8e0a59304eb99237b89593a3e839b5bb8b9a9924
226
227 Note the resulting time series of values has one less sample than the
228 expression operand passed to the rate function.
229
230 Other rules for arithmetic expressions:
231
232 1. if both operands have the semantics of a counter, then only addition
233 and subtraction are allowed
234
235 2. if the left operand is a counter and the right operand is not, then
236 only multiplication or division are allowed
237
238 3. if the left operand is not a counter and the right operand is a
239 counter, then only multiplication is allowed.
240
241 4. addition and subtraction - the dimensions of the result are the same
242 as the dimensions of the operands.
243
244 5. multiplication - the dimensions of the result are the sum of the di‐
245 mensions of the operands.
246
247 6. division - the dimensions of the result are the difference of the
248 dimensions of the operands.
249
250 Functions
251 Expression functions operate on vectors of time series values, and may
252 be nested with other functions or expressions as described above. When
253 an operand has multiple instances, there will generally be one result
254 for each series of instances. For example, the result for
255
256 $ pmseries 'min(kernel.all.load[count:100])'
257
258 will be the smallest value of the 100 most recent samples, treating
259 each of the three load average instances as a separate time series. As
260 an example, for the two most recent samples for each of the three in‐
261 stances of the load average metric:
262
263 $ pmseries 'kernel.all.load[count:2]'
264 726a325c4c1ba4339ecffcdebd240f441ea77848
265 [Tue Nov 10 11:52:30.833379000 2020] 1.100000e+00 a7c96e5e2e0431a12279756d11590fa9fed8f306
266 [Tue Nov 10 11:52:30.833379000 2020] 9.900000e-01 ee9b506935fd0976a893dc27242926f49326b9a1
267 [Tue Nov 10 11:52:30.833379000 2020] 1.070000e+00 d5e1c360d13064c461169091997e1e8be7488133
268 [Tue Nov 10 11:52:20.827134000 2020] 1.120000e+00 a7c96e5e2e0431a12279756d11590fa9fed8f306
269 [Tue Nov 10 11:52:20.827134000 2020] 9.900000e-01 ee9b506935fd0976a893dc27242926f49326b9a1
270 [Tue Nov 10 11:52:20.827134000 2020] 1.070000e+00 d5e1c360d13064c461169091997e1e8be7488133
271
272 Using the min function :
273
274 $ pmseries 'min(kernel.all.load[count:2])'
275 11b965bc5f9598034ed9139fb3a78c6c0b7065ba
276 [Tue Nov 10 11:52:30.833379000 2020] 1.100000e+00 a7c96e5e2e0431a12279756d11590fa9fed8f306
277 [Tue Nov 10 11:52:30.833379000 2020] 9.900000e-01 ee9b506935fd0976a893dc27242926f49326b9a1
278 [Tue Nov 10 11:52:30.833379000 2020] 1.070000e+00 d5e1c360d13064c461169091997e1e8be7488133
279
280 For singular metrics (with no instance domain), a single value will re‐
281 sult, e.g. for the five most recent samples of the context switching
282 metric:
283
284 $ pmseries 'kernel.all.pswitch[count:5]'
285 d7832c4fba33bcc980b1a1b614e0508043288480
286 [Tue Nov 10 12:44:59.380666000 2020] 460774294
287 [Tue Nov 10 12:44:49.382070000 2020] 460747232
288 [Tue Nov 10 12:44:39.378545000 2020] 460722370
289 [Tue Nov 10 12:44:29.379029000 2020] 460697388
290 [Tue Nov 10 12:44:19.379096000 2020] 460657412
291
292 $ pmseries 'min(kernel.all.pswitch[count:5])'
293 1b6e92fb5bc012372f54452734dd03f0f131fa06
294 [Tue Nov 10 12:44:19.379096000 2020] 460657412 d7832c4fba33bcc980b1a1b614e0508043288480
295
296
297 Future versions of pmseries may provide functions that perform aggrega‐
298 tion, interpolation, filtering or transforms in other ways, e.g. across
299 instances instead of time.
300
301 Function Reference
302 max(expr) the maximum value in the time series for each instance of ex‐
303 pr
304
305 min(expr) the minimum value in the time series for each instance of ex‐
306 pr
307
308 rate(expr) the rate with respect to time of each sample. The given ex‐
309 pr must have counter semantics and the result will have instant seman‐
310 tics (the time dimension reduced by one). In addition, the result will
311 have one less sample than the operand - this is because the first sam‐
312 ple cannot be rate converted (two samples are required).
313
314 rescale(expr,scale) rescale the values in the time series for each in‐
315 stance of expr to scale (units). Note that expr should have instant or
316 discrete semantics (not counter - rate conversion should be done first
317 if needed). The time, space and count dimensions between expr and
318 scale must be compatible. Example: rate convert the read throughput
319 counter for each disk instance and then rescale to mbytes per second.
320 Note the native units of disk.dev.read_bytes is a counter of kbytes
321 read from each device instance since boot.
322
323 $ pmseries 'rescale(rate(disk.dev.read_bytes[count:4]), "mbytes/s")'
324
325 abs(expr) the absolute value of each value in the time series for each
326 instance of expr. This has no effect if the type of expr is unsigned.
327
328 floor(expr) rounded down to the nearest integer value of the time se‐
329 ries for each instance of expr.
330
331 round(expr) rounded up or down to the nearest integer for each value in
332 the time series for each instance of expr.
333
334 log(expr) logarithm of the values in the time series for each instance
335 of expr
336
337 sqrt(expr) square root of the values in the time series for each in‐
338 stance of expr
339
340 Compatibility
341 All operands in an expression must have the same number of samples, but
342 not necessarily the same time window. e.g. you could subtract some met‐
343 ric time series from today from that of yesterday by giving different
344 time windows and different metrics or qualifiers, ensuring the same
345 number of samples are given as the operands.
346
347 Operands in an expression must either all have a time window, or none.
348 If no operands have a time window, then instead of a series of time
349 stamps and values, the result will be a time series identifier (SID)
350 that may be passed to the /series/values?series=SID REST API function,
351 along with a time window. For further details, see PMWEBAPI(3).
352
353 If the semantics of both operands in an arithmetic expression are not
354 counter (i.e. PM_SEM_INSTANT or PM_SEM_DISCRETE) then the result will
355 have semantics PM_SEM_INSTANT unless both operands are PM_SEM_DISCRETE
356 in which case the result is also PM_SEM_DISCRETE.
357
359 Using command line options, pmseries can be requested to provide meta‐
360 data (metric names, instance names, labels, descriptors) associated
361 with either individual timeseries or a group of timeseries, for exam‐
362 ple:
363
364 $ pmseries -a dcb2a032a308b5717bf605ba8f8737e9c6e1ed19
365
366 dcb2a032a308b5717bf605ba8f8737e9c6e1ed19
367 PMID: 60.0.21
368 Data Type: 64-bit unsigned int InDom: PM_INDOM_NULL 0xffffffff
369 Semantics: counter Units: millisec
370 Source: f5ca7481da8c038325d15612bb1c6473ce1ef16f
371 Metric: kernel.all.cpu.nice
372 labels {"agent":"linux","domainname":"localdomain",\
373 "groupid":1000,"hostname":"shard",\
374 "latitude":-25.28496,"longitude":152.87886,\
375 "machineid":"295b16e3b6074cc8bdbda8bf96f6930a",\
376 "userid":1000}
377
378 The complete set of pmseries metadata reporting options are:
379
380 -a, --all
381 Convenience option to report all metadata for the given time‐
382 series, equivalent to -deilms.
383
384 -d, --desc
385 Metric descriptions detailing the PMID, data type, data semantics,
386 units, scale and associated instance domain. This option has a
387 direct pminfo(1) equivalent.
388
389 -F, --fast
390 Query or load series metadata only, not values.
391
392 -g pattern, --glob=pattern
393 Provide a glob(7) pattern to restrict the report provided by the
394 -i, -l, -m, and -S.
395
396 -i, --instances
397 Metric descriptions detailing the PMID, data type, data semantics,
398 units, scale and associated instance domain.
399
400 -I, --fullindom
401 Print the InDom in verbose mode. This option has a direct pmin‐
402 fo(1) equivalent.
403
404 -l, --labels
405 Print label sets associated with metrics and instances. Labels
406 are optional metric metadata described in detail in pmLookupLa‐
407 bels(3). This option has a direct pminfo(1) equivalent.
408
409 -m, --metrics
410 Print metric names.
411
412 -M, --fullpmid
413 Print the PMID in verbose mode. This option has a direct pmin‐
414 fo(1) equivalent.
415
416 -n, --names
417 Print comma-separated label names only (not values) for the labels
418 associated with metrics and instances.
419
420 -s, --series
421 Print timeseries identifiers associated with metrics, instances
422 and sources. These unique identifiers are calculated from intrin‐
423 sic (non-optional) labels and other metric metadata associated
424 with each PMAPI context (sources), metrics and instances. Ar‐
425 chive, local context or pmcd(1) connections for the same host all
426 produce the same source identifier. This option has a direct
427 pminfo(1) equivalent. See also pmLookupLabels(3) and the -l/--la‐
428 bels option.
429
431 A source is a unique identifier (represented externally as a 40-byte
432 hexadecimal SHA-1 hash) that represents both the live host and/or ar‐
433 chives from which each timeseries originated. The context for a source
434 identifier (obtained with -s) can be reported with:
435
436 -S, --sources
437 Print names for timeseries sources. These names are either host‐
438 names or fully qualified archive paths.
439
440 It is important to note that live and archived sources can and will
441 generate the same SHA-1 source identifier hash, provided that the con‐
442 text labels remain the same for that host (labels are stored in PCP ar‐
443 chives and can also be fetched live from pmcd(1)).
444
446 Timeseries metadata and data are loaded either automatically by a local
447 pmproxy(1), or manually using a specially crafted pmseries query and
448 the -L/--load option:
449
450 $ pmseries --load "{source.path: \"$PCP_LOG_DIR/pmlogger/acme\"}"
451 pmseries: [Info] processed 2275 archive records from [...]
452
453 This query must specify a source archive path, but can also restrict
454 the import to specific timeseries (using metric names, labels, etc) and
455 to a specific time window using the time specification component of the
456 query language.
457
458 As a convenience, if the argument to load is a valid file path as de‐
459 termined by access(2), then a short-hand form can be used:
460
461 $ pmseries --load $PCP_LOG_DIR/pmlogger/acme.0
462
464 The available command line options, in addition to timeseries metadata
465 and sources options described above, are:
466
467 -c config, --config=config
468 Specify the config file to use.
469
470 -h host, --host=host
471 Connect Redis server at host, rather than the one the localhost.
472
473 -L, --load
474 Load timeseries metadata and data into the Redis cluster.
475
476 -p port, --port=port
477 Connect Redis server at port, rather than the default 6379.
478
479 -q, --query
480 Perform a timeseries query. This is the default action.
481
482 -t, --times
483 Report time stamps numerically (in milliseconds) instead of the
484 default human readable form.
485
486 -v, --values
487 Report all of the known values for given label name(s).
488
489 -V, --version
490 Display version number and exit.
491
492 -Z timezone, --timezone=timezone
493 Use timezone for the date and time. Timezone is in the format of
494 the environment variable TZ as described in environ(7).
495
496 -?, --help
497 Display usage message and exit.
498
500 The following sample query shows several fundamental aspects of the pm‐
501 series query language:
502
503 $ pmseries 'kernel.all.load{hostname:"toium"}[count:2]'
504
505 eb713a9cf472f775aa59ae90c43cd7f960f7870f
506 [Thu Nov 14 05:57:06.082861000 2019] 1.0e-01 b84040ffccd54f839b65140cf139bab51cbbcf62
507 [Thu Nov 14 05:57:06.082861000 2019] 6.8e-01 a60b5b3bf25e71071c41934fa4d7d251f765f30c
508 [Thu Nov 14 05:57:06.082861000 2019] 6.4e-01 e1974a062375e6e62370ffadf5b0650dad739480
509 [Thu Nov 14 05:57:16.091546000 2019] 1.6e-01 b84040ffccd54f839b65140cf139bab51cbbcf62
510 [Thu Nov 14 05:57:16.091546000 2019] 6.7e-01 a60b5b3bf25e71071c41934fa4d7d251f765f30c
511 [Thu Nov 14 05:57:16.091546000 2019] 6.4e-01 e1974a062375e6e62370ffadf5b0650dad739480
512
513 This query returns the two most recent values for all instances of the
514 kernel.all.load metric with a label.hostname matching the regular ex‐
515 pression "toium". This is a set-valued metric (i.e., a metric with an
516 ``instance domain'' which in this case consists of three instances: 1,
517 5 and 15 minute averages). The first column returned is a timestamp,
518 then a floating point value, and finally an instance identifier time‐
519 series hash (two values returned for three instances, so six rows are
520 returned). The metadata for these timeseries can then be further exam‐
521 ined:
522
523 $ pmseries -a eb713a9cf472f775aa59ae90c43cd7f960f7870f
524
525 eb713a9cf472f775aa59ae90c43cd7f960f7870f
526 PMID: 60.2.0
527 Data Type: float InDom: 60.2 0xf000002
528 Semantics: instant Units: none
529 Source: 0e89c1192db79326900d82131c31399524f0b3ee
530 Metric: kernel.all.load
531 inst [1 or "1 minute"] series b84040ffccd54f839b65140cf139bab51cbbcf62
532 inst [5 or "5 minute"] series a60b5b3bf25e71071c41934fa4d7d251f765f30c
533 inst [15 or "15 minute"] series e1974a062375e6e62370ffadf5b0650dad739480
534 inst [1 or "1 minute"] labels {"agent":"linux","hostname":"toium"}
535 inst [5 or "5 minute"] labels {"agent":"linux","hostname":"toium"}
536 inst [15 or "15 minute"] labels {"agent":"linux","hostname":"toium"}
537
539 Environment variables with the prefix PCP_ are used to parameterize the
540 file and directory names used by PCP. On each installation, the file
541 /etc/pcp.conf contains the local values for these variables. The
542 $PCP_CONF variable may be used to specify an alternative configuration
543 file, as described in pcp.conf(5).
544
545 For environment variables affecting PCP tools, see pmGetOptions(3).
546
548 PCPIntro(1), pmcd(1), pminfo(1), pmproxy(1), redis-server(1), ac‐
549 cess(2), PMAPI(3), PMWEBAPI(3), pmLookupDesc(3), pmLookupInDom(3), pm‐
550 LookupLabels(3), pmLookupName(3), pmNewContextZone(3), pmNewZone(3),
551 pmParseInterval(3), pmParseTimeWindow(3), pcp.conf(5), environ(7),
552 glob(7) and regex(7).
553
554
555
556Performance Co-Pilot PCP PMSERIES(1)