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