1PCP2JSON(1)                 General Commands Manual                PCP2JSON(1)
2
3
4

NAME

6       pcp2json - pcp-to-json metrics exporter
7

SYNOPSIS

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

DESCRIPTION

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

CONFIGURATION FILE

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,  include_labels,  precision,  precision_force,  count_scale,
46       count_scale_force,    space_scale,    space_scale_force,    time_scale,
47       time_scale_force.   The  output  option  is  recognized but ignored for
48       pmrep.conf compatibility.
49
50   pcp2json specific options
51       extended (boolean)
52           Write extended information about  metrics.   Corresponding  command
53           line option is -x.  Default is no.
54
55       everything (boolean)
56           Write  everything  known about metrics, including PCP internal IDs.
57           Labels  are,  however,  omitted  for  backward  compatibility,  use
58           include_labels  yes to include them as well.  Corresponding command
59           line option is -X.  Default is 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           Default is no.
65

OPTIONS

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 happens).
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 to use.  The default is the first found
122            of:             ./pcp2json.conf,             $HOME/.pcp2json.conf,
123            $HOME/pcp/pcp2json.conf,  and $PCP_SYSCONF_DIR/pcp2json.conf.  For
124            details, see the above section and pmrep.conf(5).
125
126       --container=container
127            Fetch performance metrics from  the  specified  container,  either
128            local or remote (see -h).
129
130       -C, --check
131            Exit before reporting any values, but after parsing the configura‐
132            tion and metrics and printing possible headers.
133
134       --daemonize
135            Daemonize on startup.
136
137       -e derived, --derived=derived
138            Specify derived performance metrics.  If  derived  starts  with  a
139            slash  (``/'')  or  with a dot (``.'') it will be interpreted as a
140            derived metrics configuration file, otherwise it  will  be  inter‐
141            preted  as  comma-  or  semicolon-separated derived metric expres‐
142            sions.  For details  see  pmLoadDerivedConfig(3)  and  pmRegister‐
143            Derived(3).
144
145       -E, --exact-types
146            Write  numbers  as  number data types, not as strings, potentially
147            losing some precision.
148
149       -f format, --timestamp-format=format
150            Use the format string for formatting the  timestamp.   The  format
151            will  be  used  with  Python's  datetime.strftime  method which is
152            mostly the same as that described in strftime(3).  The default  is
153            %Y-%m-%d %H:%M:%S.
154
155       -F outfile, --output-file=outfile
156            Specify the output file outfile.
157
158       -G, --no-globals
159            Do not include global metrics in reporting (see pmrep.conf(5)).
160
161       -h host, --host=host
162            Fetch  performance  metrics from pmcd(1) on host, rather than from
163            the default localhost.
164
165       -H, --no-header
166            Do not print any headers.
167
168       -i instances, --instances=instances
169            Report only  the  listed  instances  from  current  instances  (if
170            present,  see  also  -j).   By  default all instances, present and
171            future, are reported.  This is a global option that  is  used  for
172            all  metrics  unless a metric-specific instance definition is pro‐
173            vided as part of a metricspec.  By default single-valued  ``flat''
174            metrics  without  multiple  instances are still reported as usual,
175            use -v to change this.  Please refer to pmrep(1) for more  details
176            on this option.
177
178       -I, --ignore-incompat
179            Ignore  incompatible  metrics.   By  default  incompatible metrics
180            (that is, their type is unsupported or they cannot  be  scaled  as
181            requested) will cause pcp2json to terminate with an error message.
182            With this option all incompatible  metrics  are  silently  omitted
183            from  reporting.   This  may  be especially useful when requesting
184            non-leaf nodes of the PMNS tree for reporting.
185
186       -j, --live-filter
187            Perform instance live filtering.  This allows capturing  all  fil‐
188            tered  instances  even  if  processes  are restarted at some point
189            (unlike without live filtering).  Performing live filtering over a
190            huge  amount of instances will add some internal overhead so a bit
191            of user caution is advised.  See also -n.
192
193       -J rank, --rank=rank
194            Limit results to highest/lowest  ranked  instances  of  set-valued
195            metrics.  A positive integer will include highest valued instances
196            in reporting.  A  negative  integer  will  include  lowest  valued
197            instances  in  reporting.   A  value  of zero performs no ranking.
198            Ranking does not imply sorting, see -6.  See also -8.
199
200       -K spec, --spec-local=spec
201            When fetching metrics from a local context (see -L), the -K option
202            may  be used to control the DSO PMDAs that should be made accessi‐
203            ble.  The spec  argument  conforms  to  the  syntax  described  in
204            pmSpecLocalPMDA(3).  More than one -K option may be used.
205
206       -L, --local-PMDA
207            Use a local context to collect metrics from DSO PMDAs on the local
208            host without PMCD.  See also -K.
209
210       -n, --invert-filter
211            Perform ranking before live filtering.  By default  instance  live
212            filtering (when requested, see -j) happens before instance ranking
213            (when requested, see -J).  With this option the logic is  inverted
214            and ranking happens before live filtering.
215
216       -m, --include-labels
217            Include metric labels in the output.
218
219       -N predicate, --predicate=predicate
220            Specify  a comma-separated list of predicate filter reference met‐
221            rics.  By default ranking (see -J) happens for each  metric  indi‐
222            vidually.  With predicates, ranking is done only for the specified
223            predicate metrics.  When reporting, rest of  the  metrics  sharing
224            the  same  instance domain (see PCPIntro(1)) as the predicate will
225            include only the highest/lowest ranking instances  of  the  corre‐
226            sponding predicate.  Ranking does not imply sorting, see -6.
227
228            So  for  example,  using  proc.memory.rss (resident memory size of
229            process) as the predicate metric together with proc.io.total_bytes
230            and  mem.util.used  as  metrics to be reported, only the processes
231            using most/least (as per -J) memory will be included when  report‐
232            ing  total  bytes  written by processes.  Since mem.util.used is a
233            single-valued metric (thus not sharing the same instance domain as
234            the process-related metrics), it will be reported as usual.
235
236       -O origin, --origin=origin
237            When  reporting archived metrics, start reporting at origin within
238            the time window (see -S and -T).  Refer to PCPIntro(1) for a  com‐
239            plete description of the syntax for origin.
240
241       -P precision, --precision=precision
242            Use  precision for numeric non-integer output values.  The default
243            is to use 3 decimal places (when applicable).   This  option  will
244            not override possible per-metric specifications.
245
246       -q scale, --count-scale=scale
247            Unit/scale  for  count  metrics,  possible  values include count x
248            10^-1, count, count x 10, count x 10^2, and so forth from 10^-8 to
249            10^7.   (These values are currently space-sensitive.)  This option
250            will not override possible per-metric  specifications.   See  also
251            pmParseUnitsStr(3).
252
253       -Q scale, --count-scale-force=scale
254            Like -q but this option will override per-metric specifications.
255
256       -r, --raw
257            Output  raw  metric  values, do not convert cumulative counters to
258            rates.  This option will override possible  per-metric  specifica‐
259            tions.
260
261       -R, --raw-prefer
262            Like  -r  but  this option will not override per-metric specifica‐
263            tions.
264
265       -s samples, --samples=samples
266            The samples argument defines the number of samples to be retrieved
267            and  reported.   If  samples is 0 or -s is not specified, pcp2json
268            will sample and report continuously (in real time mode)  or  until
269            the  end  of  the set of PCP archives (in archive mode).  See also
270            -T.
271
272       -S starttime, --start=starttime
273            When reporting archived metrics, the report will be restricted  to
274            those  records logged at or after starttime.  Refer to PCPIntro(1)
275            for a complete description of the syntax for starttime.
276
277       -t interval, --interval=interval
278            Set the reporting interval to something other than the  default  1
279            second.   The  interval  argument  follows the syntax described in
280            PCPIntro(1), and in the simplest form may be an  unsigned  integer
281            (the  implied  units  in  this case are seconds).  See also the -T
282            option.
283
284       -T endtime, --finish=endtime
285            When reporting archived metrics, the report will be restricted  to
286            those  records  logged before or at endtime.  Refer to PCPIntro(1)
287            for a complete description of the syntax for endtime.
288
289            When used to define the runtime before pcp2json will exit,  if  no
290            samples  is  given  (see  -s)  then the number of reported samples
291            depends on interval (see -t).  If samples is given  then  interval
292            will be adjusted to allow reporting of samples during runtime.  In
293            case all of -T, -s, and  -t  are  given,  endtime  determines  the
294            actual time pcp2json will run.
295
296       -v, --omit-flat
297            Omit  single-valued ``flat'' metrics from reporting, only consider
298            set-valued  metrics  (i.e.,  metrics  with  multiple  values)  for
299            reporting.  See -i and -I.
300
301       -V, --version
302            Display version number and exit.
303
304       -x, --with-extended
305            Write extended information.
306
307       -X, --with-everything
308            Write  everything known about metrics, including PCP internal IDs.
309            Labels are, however, omitted for backward compatibility, use -m to
310            include them as well.
311
312       -y scale, --time-scale=scale
313            Unit/scale  for time metrics, possible values include nanosec, ns,
314            microsec, us, millisec, ms, and so forth up  to  hour,  hr.   This
315            option  will not override possible per-metric specifications.  See
316            also pmParseUnitsStr(3).
317
318       -Y scale, --time-scale-force=scale
319            Like -y but this option will override per-metric specifications.
320
321       -z, --hostzone
322            Use the local timezone of the host that is the source of the  per‐
323            formance  metrics,  as  identified  by  either  the  -h  or the -a
324            options.  The default is to use the timezone of the local host.
325
326       -Z timezone, --timezone=timezone
327            Use timezone for the date and time.  Timezone is in the format  of
328            the environment variable TZ as described in environ(7).  Note that
329            when including a timezone string in output, ISO  8601  -style  UTC
330            offsets are used (so something like -Z EST+5 will become UTC-5).
331
332       -?, --help
333            Display usage message and exit.
334

FILES

336       pcp2json.conf
337            pcp2json configuration file (see -c)
338

PCP ENVIRONMENT

340       Environment variables with the prefix PCP_ are used to parameterize the
341       file and directory names used by PCP.  On each installation,  the  file
342       /etc/pcp.conf  contains  the  local  values  for  these variables.  The
343       $PCP_CONF variable may be used to specify an alternative  configuration
344       file, as described in pcp.conf(5).
345
346       For environment variables affecting PCP tools, see pmGetOptions(3).
347

SEE ALSO

349       mkaf(1),  PCPIntro(1),  pcp(1),  pcp2elasticsearch(1), pcp2graphite(1),
350       pcp2influxdb(1), pcp2spark(1), pcp2xlsx(1), pcp2xml(1),  pcp2zabbix(1),
351       pmcd(1),   pminfo(1),  pmrep(1),  pmGetOptions(3),  pmSpecLocalPMDA(3),
352       pmLoadDerivedConfig(3), pmParseUnitsStr(3), pmRegisterDerived(3), LOGA‐
353       RCHIVE(5), pcp.conf(5), PMNS(5), pmrep.conf(5) and environ(7).
354
355
356
357Performance Co-Pilot                  PCP                          PCP2JSON(1)
Impressum