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