1PCP2JSON(1) General Commands Manual PCP2JSON(1)
2
3
4
6 pcp2json - pcp-to-json metrics exporter
7
9 pcp2json [-5CEGHIjLmnrRvVxXz?] [-4 action] [-8|-9 limit] [-a archive]
10 [-A align] [--archive-folio folio] [-b|-B space-scale] [-c config]
11 [--container container] [--daemonize] [-e derived] [-f format] [-F out‐
12 file] [-h host] [-i instances] [-J rank] [-K spec] [-N predicate] [-o
13 timeout] [-O origin] [-p password] [-P|-0 precision] [-q|-Q count-
14 scale] [-s samples] [-S starttime] [-t interval] [-T endtime] [-u url]
15 [-U username] [-y|-Y time-scale] [-Z timezone] metricspec [...]
16
18 pcp2json is a customizable performance metrics exporter tool from PCP
19 to JSON. Any available performance metric, live or archived, system
20 and/or application, can be selected for exporting using either command
21 line arguments or a configuration file.
22
23 pcp2json is a close relative of pmrep(1). Refer to pmrep(1) for the
24 metricspec description accepted on pcp2json command line. See pm‐
25 rep.conf(5) for description of the pcp2json.conf configuration file
26 syntax. This page describes pcp2json specific options and configura‐
27 tion file differences with pmrep.conf(5). pmrep(1) also lists some us‐
28 age examples of which most are applicable with pcp2json as well.
29
30 Only the command line options listed on this page are supported, other
31 options available for pmrep(1) are not supported.
32
33 Options via environment values (see pmGetOptions(3)) override the cor‐
34 responding built-in default values (if any). Configuration file op‐
35 tions override the corresponding environment variables (if any). Com‐
36 mand line options override the corresponding configuration file options
37 (if any).
38
40 pcp2json uses a configuration file with syntax described in pm‐
41 rep.conf(5). The following options are common with pmrep.conf: ver‐
42 sion, source, speclocal, derived, header, globals, samples, interval,
43 type, type_prefer, ignore_incompat, names_change, instances, live_fil‐
44 ter, rank, limit_filter, limit_filter_force, invert_filter, predicate,
45 omit_flat, include_labels, precision, precision_force, count_scale,
46 count_scale_force, space_scale, space_scale_force, time_scale,
47 time_scale_force. The rest of the pmrep.conf options are recognized
48 but ignored for compatibility.
49
50 pcp2json specific options
51 extended (boolean)
52 Write extended information about metrics. Corresponding command
53 line option is -x. Defaults to no.
54
55 everything (boolean)
56 Write everything known about metrics, including PCP internal IDs.
57 Labels are, however, omitted for backward compatibility. Enable
58 include_labels to include them as well. Corresponding command line
59 option is -X. Defaults to no.
60
61 exact_types (boolean)
62 Write numbers as number data types, not as strings, potentially
63 losing some precision. Corresponding command line option is -E.
64 Defaults to no.
65
66 url (string)
67 Send JSON output as a HTTP POST to the given url. Corresponding
68 command line option is -u. Defaults to None.
69
70 http_pass (string)
71 Use given password for Basic Authentication when sending a HTTP
72 POST. Corresponding command line option is -p. Defaults to None.
73
74 http_user (string)
75 Use given username for Basic Authentication when sending a HTTP
76 POST. Corresponding command line option is -U. Defaults to None.
77
78 http_timeout (number)
79 Maximum time (in seconds) when sending a HTTP POST. Corresponding
80 command line option is -o. Defaults to 2.5 seconds.
81
83 The available command line options are:
84
85 -0 precision, --precision-force=precision
86 Like -P but this option will override per-metric specifications.
87
88 -4 action, --names-change=action
89 Specify which action to take on receiving a metric names change
90 event during sampling. These events occur when a PMDA discovers
91 new metrics sometime after starting up, and informs running client
92 tools like pcp2json. Valid values for action are update (refresh
93 metrics being sampled), ignore (do nothing - the default behav‐
94 iour) and abort (exit the program if such an event occurs).
95
96 -5, --ignore-unknown
97 Silently ignore any metric name that cannot be resolved. At least
98 one metric must be found for the tool to start.
99
100 -8 limit, --limit-filter=limit
101 Limit results to instances with values above/below limit. A posi‐
102 tive integer will include instances with values at or above the
103 limit in reporting. A negative integer will include instances
104 with values at or below the limit in reporting. A value of zero
105 performs no limit filtering. This option will not override possi‐
106 ble per-metric specifications. See also -J and -N.
107
108 -9 limit, --limit-filter-force=limit
109 Like -8 but this option will override per-metric specifications.
110
111 -a archive, --archive=archive
112 Performance metric values are retrieved from the set of Perfor‐
113 mance Co-Pilot (PCP) archive files identified by the archive argu‐
114 ment, which is a comma-separated list of names, each of which may
115 be the base name of an archive or the name of a directory contain‐
116 ing one or more archives.
117
118 -A align, --align=align
119 Force the initial sample to be aligned on the boundary of a natu‐
120 ral time unit align. Refer to PCPIntro(1) for a complete descrip‐
121 tion of the syntax for align.
122
123 --archive-folio=folio
124 Read metric source archives from the PCP archive folio created by
125 tools like pmchart(1) or, less often, manually with mkaf(1).
126
127 -b scale, --space-scale=scale
128 Unit/scale for space (byte) metrics, possible values include
129 bytes, Kbytes, KB, Mbytes, MB, and so forth. This option will not
130 override possible per-metric specifications. See also pmParseU‐
131 nitsStr(3).
132
133 -B scale, --space-scale-force=scale
134 Like -b but this option will override per-metric specifications.
135
136 -c config, --config=config
137 Specify the config file or directory to use. In case config is a
138 directory all files in it ending .conf will be included. The de‐
139 fault is the first found of: ./pcp2json.conf,
140 $HOME/.pcp2json.conf, $HOME/pcp/pcp2json.conf, and
141 $PCP_SYSCONF_DIR/pcp2json.conf. For details, see the above sec‐
142 tion and pmrep.conf(5).
143
144 --container=container
145 Fetch performance metrics from the specified container, either lo‐
146 cal or remote (see -h).
147
148 -C, --check
149 Exit before reporting any values, but after parsing the configura‐
150 tion and metrics and printing possible headers.
151
152 --daemonize
153 Daemonize on startup.
154
155 -e derived, --derived=derived
156 Specify derived performance metrics. If derived starts with a
157 slash (``/'') or with a dot (``.'') it will be interpreted as a
158 PCP derived metrics configuration file, otherwise it will be in‐
159 terpreted as comma- or semicolon-separated derived metric expres‐
160 sions. For complete description of derived metrics and PCP de‐
161 rived metrics configuration files see pmLoadDerivedConfig(3) and
162 pmRegisterDerived(3). Alternatively, using pmrep.conf(5) configu‐
163 ration syntax allows defining derived metrics as part of metric‐
164 sets.
165
166 -E, --exact-types
167 Write numbers as number data types, not as strings, potentially
168 losing some precision.
169
170 -f format, --timestamp-format=format
171 Use the format string for formatting the timestamp. The format
172 will be used with Python's datetime.strftime method which is
173 mostly the same as that described in strftime(3). The default is
174 %Y-%m-%d %H:%M:%S.
175
176 -F outfile, --output-file=outfile
177 Specify the output file outfile.
178
179 -G, --no-globals
180 Do not include global metrics in reporting (see pmrep.conf(5)).
181
182 -h host, --host=host
183 Fetch performance metrics from pmcd(1) on host, rather than from
184 the default localhost.
185
186 -H, --no-header
187 Do not print any headers.
188
189 -i instances, --instances=instances
190 Retrieve and report only the specified metric instances. By de‐
191 fault all instances, present and future, are reported.
192
193 Refer to pmrep(1) for complete description of this option.
194
195 -I, --ignore-incompat
196 Ignore incompatible metrics. By default incompatible metrics
197 (that is, their type is unsupported or they cannot be scaled as
198 requested) will cause pcp2json to terminate with an error message.
199 With this option all incompatible metrics are silently omitted
200 from reporting. This may be especially useful when requesting
201 non-leaf nodes of the PMNS tree for reporting.
202
203 -j, --live-filter
204 Perform instance live filtering. This allows capturing all named
205 instances even if processes are restarted at some point (unlike
206 without live filtering). Performing live filtering over a huge
207 number of instances will add some internal overhead so a bit of
208 user caution is advised. See also -n.
209
210 -J rank, --rank=rank
211 Limit results to highest/lowest ranked instances of set-valued
212 metrics. A positive integer will include highest valued instances
213 in reporting. A negative integer will include lowest valued in‐
214 stances in reporting. A value of zero performs no ranking. Rank‐
215 ing does not imply sorting, see -6. See also -8.
216
217 -K spec, --spec-local=spec
218 When fetching metrics from a local context (see -L), the -K option
219 may be used to control the DSO PMDAs that should be made accessi‐
220 ble. The spec argument conforms to the syntax described in pm‐
221 SpecLocalPMDA(3). More than one -K option may be used.
222
223 -L, --local-PMDA
224 Use a local context to collect metrics from DSO PMDAs on the local
225 host without PMCD. See also -K.
226
227 -n, --invert-filter
228 Perform ranking before live filtering. By default instance live
229 filtering (when requested, see -j) happens before instance ranking
230 (when requested, see -J). With this option the logic is inverted
231 and ranking happens before live filtering.
232
233 -m, --include-labels
234 Include PCP metric labels in the output.
235
236 -N predicate, --predicate=predicate
237 Specify a comma-separated list of predicate filter reference met‐
238 rics. By default ranking (see -J) happens for each metric indi‐
239 vidually. With predicates, ranking is done only for the specified
240 predicate metrics. When reporting, rest of the metrics sharing
241 the same instance domain (see PCPIntro(1)) as the predicate will
242 include only the highest/lowest ranking instances of the corre‐
243 sponding predicate. Ranking does not imply sorting, see -6.
244
245 So for example, using proc.memory.rss (resident memory size of
246 process) as the predicate metric together with proc.io.total_bytes
247 and mem.util.used as metrics to be reported, only the processes
248 using most/least (as per -J) memory will be included when report‐
249 ing total bytes written by processes. Since mem.util.used is a
250 single-valued metric (thus not sharing the same instance domain as
251 the process related metrics), it will be reported as usual.
252
253 -o, --http-timeout
254 Timeout (in seconds) when sending a HTTP POST with the -u option.
255 Default value is 2.5 seconds.
256
257 -O origin, --origin=origin
258 When reporting archived metrics, start reporting at origin within
259 the time window (see -S and -T). Refer to PCPIntro(1) for a com‐
260 plete description of the syntax for origin.
261
262 -p, --http-pass
263 Password when using HTTP basic authentication with the -u option.
264
265 -P precision, --precision=precision
266 Use precision for numeric non-integer output values. The default
267 is to use 3 decimal places (when applicable). This option will
268 not override possible per-metric specifications.
269
270 -q scale, --count-scale=scale
271 Unit/scale for count metrics, possible values include count x
272 10^-1, count, count x 10, count x 10^2, and so forth from 10^-8 to
273 10^7. (These values are currently space-sensitive.) This option
274 will not override possible per-metric specifications. See also
275 pmParseUnitsStr(3).
276
277 -Q scale, --count-scale-force=scale
278 Like -q but this option will override per-metric specifications.
279
280 -r, --raw
281 Output raw metric values, do not convert cumulative counters to
282 rates. This option will override possible per-metric specifica‐
283 tions.
284
285 -R, --raw-prefer
286 Like -r but this option will not override per-metric specifica‐
287 tions.
288
289 -s samples, --samples=samples
290 The samples argument defines the number of samples to be retrieved
291 and reported. If samples is 0 or -s is not specified, pcp2json
292 will sample and report continuously (in real time mode) or until
293 the end of the set of PCP archives (in archive mode). See also
294 -T.
295
296 -S starttime, --start=starttime
297 When reporting archived metrics, the report will be restricted to
298 those records logged at or after starttime. Refer to PCPIntro(1)
299 for a complete description of the syntax for starttime.
300
301 -t interval, --interval=interval
302 Set the reporting interval to something other than the default 1
303 second. The interval argument follows the syntax described in
304 PCPIntro(1), and in the simplest form may be an unsigned integer
305 (the implied units in this case are seconds). See also the -T op‐
306 tion.
307
308 -T endtime, --finish=endtime
309 When reporting archived metrics, the report will be restricted to
310 those records logged before or at endtime. Refer to PCPIntro(1)
311 for a complete description of the syntax for endtime.
312
313 When used to define the runtime before pcp2json will exit, if no
314 samples is given (see -s) then the number of reported samples de‐
315 pends on interval (see -t). If samples is given then interval
316 will be adjusted to allow reporting of samples during runtime. In
317 case all of -T, -s, and -t are given, endtime determines the ac‐
318 tual time pcp2json will run.
319
320 -u, --url
321 URL for sending an HTTP POST (instead of default standard output).
322
323 -U, --http-user
324 Username when using HTTP basic authentication with the -u option.
325
326 -v, --omit-flat
327 Report only set-valued metrics with instances (e.g. disk.dev.read)
328 and omit single-valued ``flat'' metrics without instances (e.g.
329 kernel.all.sysfork). See -i and -I.
330
331 -V, --version
332 Display version number and exit.
333
334 -x, --with-extended
335 Write extended information.
336
337 -X, --with-everything
338 Write everything known about metrics, including PCP internal IDs.
339 Labels are, however, omitted for backward compatibility, use -m to
340 include them as well.
341
342 -y scale, --time-scale=scale
343 Unit/scale for time metrics, possible values include nanosec, ns,
344 microsec, us, millisec, ms, and so forth up to hour, hr. This op‐
345 tion will not override possible per-metric specifications. See
346 also pmParseUnitsStr(3).
347
348 -Y scale, --time-scale-force=scale
349 Like -y but this option will override per-metric specifications.
350
351 -z, --hostzone
352 Use the local timezone of the host that is the source of the per‐
353 formance metrics, as identified by either the -h or the -a op‐
354 tions. The default is to use the timezone of the local host.
355
356 -Z timezone, --timezone=timezone
357 Use timezone for the date and time. Timezone is in the format of
358 the environment variable TZ as described in environ(7). Note that
359 when including a timezone string in output, ISO 8601 -style UTC
360 offsets are used (so something like -Z EST+5 will become UTC-5).
361
362 -?, --help
363 Display usage message and exit.
364
366 pcp2json.conf
367 pcp2json configuration file (see -c)
368
369 $PCP_SYSCONF_DIR/pmrep/*.conf
370 system provided default pmrep configuration files
371
373 Environment variables with the prefix PCP_ are used to parameterize the
374 file and directory names used by PCP. On each installation, the file
375 /etc/pcp.conf contains the local values for these variables. The
376 $PCP_CONF variable may be used to specify an alternative configuration
377 file, as described in pcp.conf(5).
378
379 For environment variables affecting PCP tools, see pmGetOptions(3).
380
382 PCPIntro(1), mkaf(1), pcp(1), pcp2elasticsearch(1), pcp2graphite(1),
383 pcp2influxdb(1), pcp2spark(1), pcp2xlsx(1), pcp2xml(1), pcp2zabbix(1),
384 pmcd(1), pminfo(1), pmrep(1), pmGetOptions(3), pmLoadDerivedConfig(3),
385 pmParseUnitsStr(3), pmRegisterDerived(3), pmSpecLocalPMDA(3), LOGA‐
386 RCHIVE(5), pcp.conf(5), pmrep.conf(5), PMNS(5) and environ(7).
387
388
389
390Performance Co-Pilot PCP PCP2JSON(1)