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
19 instance. If this instance is a node of a Redis cluster, all other
20 instances 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
26 local 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
41 reported with pminfo(1) and the pmcd.labels metric.
42
43 See pmLookupLabels(3), pmLookupInDom(3), pmLookupName(3) and
44 pmLookupDesc(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
56 options) depends on the arguments it is presented. If all non-option
57 arguments appear to be timeseries identifiers (in 40 hex digit form)
58 pmseries will report metadata for these timeseries - refer to the -a
59 option for details. Otherwise, the parameters will be treated as a
60 timeseries query.
61
63 Query expressions are formed using the pmseries query language
64 described 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., regu‐
119 lar expression 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 -g pattern, --glob=pattern
390 Provide a glob(7) pattern to restrict the report provided by the
391 -i, -l, -m, and -S.
392
393 -i, --instances
394 Metric descriptions detailing the PMID, data type, data semantics,
395 units, scale and associated instance domain.
396
397 -I, --fullindom
398 Print the InDom in verbose mode. This option has a direct pmin‐
399 fo(1) equivalent.
400
401 -l, --labels
402 Print label sets associated with metrics and instances. Labels
403 are optional metric metadata described in detail in pmLookupLa‐
404 bels(3). This option has a direct pminfo(1) equivalent.
405
406 -m, --metrics
407 Print metric names.
408
409 -M, --fullpmid
410 Print the PMID in verbose mode. This option has a direct pmin‐
411 fo(1) equivalent.
412
413 -n, --names
414 Print comma-separated label names only (not values) for the labels
415 associated with metrics and instances.
416
417 -s, --series
418 Print timeseries identifiers associated with metrics, instances
419 and sources. These unique identifiers are calculated from intrin‐
420 sic (non-optional) labels and other metric metadata associated
421 with each PMAPI context (sources), metrics and instances. Ar‐
422 chive, local context or pmcd(1) connections for the same host all
423 produce the same source identifier. This option has a direct
424 pminfo(1) equivalent. See also pmLookupLabels(3) and the -l/--la‐
425 bels option.
426
428 A source is a unique identifier (represented externally as a 40-byte
429 hexadecimal SHA-1 hash) that represents both the live host and/or ar‐
430 chives from which each timeseries originated. The context for a source
431 identifier (obtained with -s) can be reported with:
432
433 -S, --sources
434 Print names for timeseries sources. These names are either host‐
435 names or fully qualified archive paths.
436
437 It is important to note that live and archived sources can and will
438 generate the same SHA-1 source identifier hash, provided that the con‐
439 text labels remain the same for that host (labels are stored in PCP ar‐
440 chives and can also be fetched live from pmcd(1)).
441
443 Timeseries metadata and data are loaded either automatically by a local
444 pmproxy(1), or manually using a specially crafted pmseries query and
445 the -L/--load option:
446
447 $ pmseries --load "{source.path: \"$PCP_LOG_DIR/pmlogger/acme\"}"
448 pmseries: [Info] processed 2275 archive records from [...]
449
450 This query must specify a source archive path, but can also restrict
451 the import to specific timeseries (using metric names, labels, etc) and
452 to a specific time window using the time specification component of the
453 query language.
454
455 As a convenience, if the argument to load is a valid file path as de‐
456 termined by access(2), then a short-hand form can be used:
457
458 $ pmseries --load $PCP_LOG_DIR/pmlogger/acme.0
459
461 The available command line options, in addition to timeseries metadata
462 and sources options described above, are:
463
464 -c config, --config=config
465 Specify the config file to use.
466
467 -h host, --host=host
468 Connect Redis server at host, rather than the one the localhost.
469
470 -L, --load
471 Load timeseries metadata and data into the Redis cluster.
472
473 -p port, --port=port
474 Connect Redis server at port, rather than the default 6379.
475
476 -q, --query
477 Perform a timeseries query. This is the default action.
478
479 -t, --times
480 Report time stamps numerically (in milliseconds) instead of the
481 default human readable form.
482
483 -v, --values
484 Report all of the known values for given label name(s).
485
486 -V, --version
487 Display version number and exit.
488
489 -Z timezone, --timezone=timezone
490 Use timezone for the date and time. Timezone is in the format of
491 the environment variable TZ as described in environ(7).
492
493 -?, --help
494 Display usage message and exit.
495
497 The following sample query shows several fundamental aspects of the pm‐
498 series query language:
499
500 $ pmseries 'kernel.all.load{hostname:"toium"}[count:2]'
501
502 eb713a9cf472f775aa59ae90c43cd7f960f7870f
503 [Thu Nov 14 05:57:06.082861000 2019] 1.0e-01 b84040ffccd54f839b65140cf139bab51cbbcf62
504 [Thu Nov 14 05:57:06.082861000 2019] 6.8e-01 a60b5b3bf25e71071c41934fa4d7d251f765f30c
505 [Thu Nov 14 05:57:06.082861000 2019] 6.4e-01 e1974a062375e6e62370ffadf5b0650dad739480
506 [Thu Nov 14 05:57:16.091546000 2019] 1.6e-01 b84040ffccd54f839b65140cf139bab51cbbcf62
507 [Thu Nov 14 05:57:16.091546000 2019] 6.7e-01 a60b5b3bf25e71071c41934fa4d7d251f765f30c
508 [Thu Nov 14 05:57:16.091546000 2019] 6.4e-01 e1974a062375e6e62370ffadf5b0650dad739480
509
510 This query returns the two most recent values for all instances of the
511 kernel.all.load metric with a label.hostname matching the regular ex‐
512 pression "toium". This is a set-valued metric (i.e., a metric with an
513 ``instance domain'' which in this case consists of three instances: 1,
514 5 and 15 minute averages). The first column returned is a timestamp,
515 then a floating point value, and finally an instance identifier time‐
516 series hash (two values returned for three instances, so six rows are
517 returned). The metadata for these timeseries can then be further exam‐
518 ined:
519
520 $ pmseries -a eb713a9cf472f775aa59ae90c43cd7f960f7870f
521
522 eb713a9cf472f775aa59ae90c43cd7f960f7870f
523 PMID: 60.2.0
524 Data Type: float InDom: 60.2 0xf000002
525 Semantics: instant Units: none
526 Source: 0e89c1192db79326900d82131c31399524f0b3ee
527 Metric: kernel.all.load
528 inst [1 or "1 minute"] series b84040ffccd54f839b65140cf139bab51cbbcf62
529 inst [5 or "5 minute"] series a60b5b3bf25e71071c41934fa4d7d251f765f30c
530 inst [15 or "15 minute"] series e1974a062375e6e62370ffadf5b0650dad739480
531 inst [1 or "1 minute"] labels {"agent":"linux","hostname":"toium"}
532 inst [5 or "5 minute"] labels {"agent":"linux","hostname":"toium"}
533 inst [15 or "15 minute"] labels {"agent":"linux","hostname":"toium"}
534
536 Environment variables with the prefix PCP_ are used to parameterize the
537 file and directory names used by PCP. On each installation, the file
538 /etc/pcp.conf contains the local values for these variables. The
539 $PCP_CONF variable may be used to specify an alternative configuration
540 file, as described in pcp.conf(5).
541
542 For environment variables affecting PCP tools, see pmGetOptions(3).
543
545 PCPIntro(1), pmcd(1), pminfo(1), pmproxy(1), redis-server(1), ac‐
546 cess(2), PMAPI(3), PMWEBAPI(3), pmLookupDesc(3), pmLookupInDom(3), pm‐
547 LookupLabels(3), pmLookupName(3), pmNewContextZone(3), pmNewZone(3),
548 pmParseInterval(3), pmParseTimeWindow(3), pcp.conf(5), environ(7),
549 glob(7) and regex(7).
550
551
552
553Performance Co-Pilot PCP PMSERIES(1)