PCP2ELASTICSEARCH(1)

๐Ÿ’– PCP2ELASTICSEARCH(1) ๐Ÿ’– โ€” General Commands Manual

okay bestie, gather round, because this is the manual page for pcp2elasticsearch and it's a whole vibe ๐Ÿฆ‹. It's a section 1 command, it lives with the general commands, and it is so much more chill than it looks. Let's get into it. โœจ


๐ŸŒธ NAME ๐ŸŒธ

pcp2elasticsearch โ€” the pcp-to-elasticsearch metrics exporter. that's it, that's the name, and honestly? iconic. ๐Ÿ’…


โœจ SYNOPSIS โœจ

pcp2elasticsearch [-5CGHIjLmnrRvV?]  [-4 action] [-8|-9 limit] [-a
archive] [-A align] [--archive-folio folio] [-b|-B space-scale] [-c
config] [--container container] [-D debug] [--daemonize] [-e derived]
[-g URL] [-h host] [-i instances] [-J rank] [-K spec] [-N predicate] [-O
origin] [-p type] [-P|-0 precision] [-q|-Q count-scale] [-s samples] [-S
starttime] [-t interval] [-T endtime] [-x index] [-X hostid] [-y|-Y
time-scale] metricspec [...]

yes there are a LOT of flags. yes we're going to go through every single one. no we are not skipping any. ๐Ÿซถ


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

pcp2elasticsearch is your customizable performance metrics exporter bestie, moving things from PCP over to Elasticsearch. Any available performance metric โ€” live or archived, system and/or application โ€” can be picked for exporting, and you get to choose it either with command line arguments or a configuration file. your call, queen. ๐Ÿ‘‘

pcp2elasticsearch is a close relative of pmrep(1) โ€” like, literally cousins. So go read pmrep(1) for the description of the metricspec that's accepted on the pcp2elasticsearch command line. And see pmrep.conf(5) for the description of the pcp2elasticsearch.conf configuration file syntax. This page right here is all about the stuff that's specific to pcp2elasticsearch and the ways its config file differs from pmrep.conf(5). Oh and pmrep(1) also has some usage examples, most of which work just as well with pcp2elasticsearch. slay.

โš ๏ธ Only the command line options listed on this page are supported, okay? The other options that exist for pmrep(1)? Not supported here. sorry not sorry. ๐Ÿ™ˆ

Now the precedence tea, because this matters: options via environment values (see pmGetOptions(3)) override the corresponding built-in default values (if any). Configuration file options override the corresponding environment variables (if any). And command line options override the corresponding configuration file options (if any). It's a whole hierarchy and command line is the main character. ๐Ÿ’…


๐ŸŽ€ CONFIGURATION FILE ๐ŸŽ€

pcp2elasticsearch uses a configuration file with syntax described in pmrep.conf(5). The following options are common with pmrep.conf: version, source, speclocal, derived, header, globals, samples, interval, type, type_prefer, ignore_incompat, names_change, instances, live_filter, rank, limit_filter, limit_filter_force, invert_filter, predicate, omit_flat, include_labels, precision, precision_force, count_scale, count_scale_force, space_scale, space_scale_force, time_scale, time_scale_force. The rest of the pmrep.conf options are recognized but ignored, purely for compatibility. they're just there vibing in the background. ๐Ÿ’€

๐ŸŒˆ pcp2elasticsearch specific options ๐ŸŒˆ

  • es_server (string) โ€” Specify the destination Elasticsearch server metric URL. Corresponding command line option is -g. Defaults to http://localhost:9200/. ๐Ÿ 
  • es_auth (string) โ€” Specify the user name to use with Elasticsearch requests. Defaults to none. ngl, "none" is a mood.
  • es_password (string) โ€” Specify the pass word to use with Elasticsearch requests. Defaults to none. keep it secret, keep it safe bestie. ๐Ÿ”
  • es_index (string) โ€” Specify the Elasticsearch index for metric names. Corresponding command line option is -x. Defaults to pcp. ๐Ÿ“‡
  • es_hostid (string) โ€” Specify the Elasticsearch host-id for measurements. Corresponding command line option is -X. Defaults to the metrics source host. ๐Ÿ–ฅ๏ธ
  • es_search_type (string) โ€” Specify the Elasticsearch search type for measurements. Corresponding command line option is -p. Defaults to pcp-metric. ๐Ÿ”

โœจ OPTIONS โœจ

The available command line options are, in order, all of them, no skipping, we're doing this: ๐Ÿ’–

  • -0 precision, --precision-force=precision โ€” Like -P but this option will override per-metric specifications. forceful. bold. love that for it.
  • -4 action, --names-change=action โ€” Specify which action to take on receiving a metric names change event during sampling. These events occur when a PMDA discovers new metrics sometime after starting up, and informs running client tools like pcp2elasticsearch. Valid values for action are update (refresh metrics being sampled), ignore (do nothing โ€” the default behaviour) and abort (exit the program if such an event occurs). pick your fighter. ๐ŸฅŠ
  • -5, --ignore-unknown โ€” Silently ignore any metric name that cannot be resolved. At least one metric must be found for the tool to start. so like, it can ghost some metrics but not all of them. ๐Ÿ’€
  • -8 limit, --limit-filter=limit โ€” Limit results to instances with values above/below limit. A positive integer will include instances with values at or above the limit in reporting. A negative integer will include instances with values at or below the limit in reporting. A value of zero performs no limit filtering. This option will not override possible per-metric specifications. See also -J and -N. ๐ŸŽฏ
  • -9 limit, --limit-filter-force=limit โ€” Like -8 but this option will override per-metric specifications. it does not ask permission. โœจ
  • -a archive, --archive=archive โ€” Performance metric values are retrieved from the set of Performance Co-Pilot (PCP) archive files identified by the archive argument, which is a comma-separated list of names, each of which may be the base name of an archive or the name of a directory containing one or more archives. throwback metrics, we love to see it. ๐Ÿ“ผ
  • -A align, --align=align โ€” Force the initial sample to be aligned on the boundary of a natural time unit align. Refer to PCPIntro(1) for a complete description of the syntax for align. so satisfying when things line up. ๐Ÿ˜Œ
  • --archive-folio=folio โ€” Read metric source archives from the PCP archive folio created by tools like pmchart(1) or, less often, manually with mkaf(1). fancy. ๐ŸŽ€
  • -b scale, --space-scale=scale โ€” Unit/scale for space (byte) metrics, possible values include bytes, Kbytes, KB, Mbytes, MB, and so forth. This option will not override possible per-metric specifications. See also pmParseUnitsStr(3). ๐Ÿ“
  • -B scale, --space-scale-force=scale โ€” Like -b but this option will override per-metric specifications. no cap. ๐Ÿ’…
  • -c config, --config=config โ€” Specify the config file or directory to use. In case config is a directory all files in it ending .conf will be included. The default is the first found of: ./pcp2elasticsearch.conf, $HOME/.pcp2elasticsearch.conf, $HOME/pcp/pcp2elasticsearch.conf, and $PCP_SYSCONF_DIR/pcp2elasticsearch.conf. For details, see the above section and pmrep.conf(5). it goes looking for you, that's devotion. ๐Ÿฅน
  • --container=container โ€” Fetch performance metrics from the specified container, either local or remote (see -h). ๐Ÿ“ฆ
  • -C, --check โ€” Exit before reporting any values, but after parsing the configuration and metrics and printing possible headers. it's giving "just checking, not committing". โœ…
  • --daemonize โ€” Daemonise on startup. disappear into the background, mysterious icon. ๐ŸŒ™
  • -e derived, --derived=derived โ€” Specify derived performance metrics. If derived starts with a slash (/) or with a dot (.) it will be interpreted as a PCP derived metrics configuration file, otherwise it will be interpreted as comma- or semicolon-separated derived metric expressions. For complete description of derived metrics and PCP derived metrics configuration files see pmLoadDerivedConfig(3) and pmRegisterDerived(3). Alternatively, using pmrep.conf(5) configuration syntax allows defining derived metrics as part of metricsets.

In case of issues with derived metrics, review the aforementioned manual pages in detail and ensure all the required metrics are available, especially when using archives. Use -Dderive to see additional debug information about parsing derived metrics. ๐Ÿงฎ

  • -g URL, --es-host=URL โ€” Destination Elasticsearch server metric URL. ๐Ÿ“ก
  • -G, --no-globals โ€” Do not include global metrics in reporting (see pmrep.conf(5)). globals? not today. ๐Ÿšซ
  • -h host, --host=host โ€” Fetch performance metrics from pmcd(1) on host, rather than from the default localhost. go explore bestie. ๐ŸŒ
  • -H, --no-header โ€” Do not print any headers. minimalism era. โœจ
  • -i instances, --instances=instances โ€” Retrieve and report only the specified metric instances. By default all instances, present and future, are reported.

Refer to pmrep(1) for complete description of this option. ๐Ÿ‘€

  • -I, --ignore-incompat โ€” Ignore incompatible metrics. By default incompatible metrics (that is, their type is unsupported or they cannot be scaled as requested) will cause pcp2elasticsearch to terminate with an error message. With this option all incompatible metrics are silently omitted from reporting. This may be especially useful when requesting non-leaf nodes of the PMNS tree for reporting. let them go, they weren't your vibe anyway. ๐Ÿƒ
  • -j, --live-filter โ€” Perform instance live filtering. This allows capturing all named instances even if processes are restarted at some point (unlike without live filtering). Performing live filtering over a huge number of instances will add some internal overhead so a bit of user caution is advised. See also -n. โš ๏ธ
  • -J rank, --rank=rank โ€” Limit results to highest/lowest ranked instances of set-valued metrics. A positive integer will include highest valued instances in reporting. A negative integer will include lowest valued instances in reporting. A value of zero performs no ranking. Ranking does not imply sorting, see -6. See also -8. ๐Ÿ†
  • -K spec, --spec-local=spec โ€” When fetching metrics from a local context (see -L), the -K option may be used to control the DSO PMDAs that should be made accessible. The spec argument conforms to the syntax described in pmSpecLocalPMDA(3). More than one -K option may be used. stack 'em. ๐Ÿงฑ
  • -L, --local-PMDA โ€” Use a local context to collect metrics from DSO PMDAs on the local host without PMCD. See also -K. do it yourself energy. ๐Ÿ’ช
  • -m, --include-labels โ€” Include PCP metric labels in the output. ๐Ÿท๏ธ
  • -n, --invert-filter โ€” Perform ranking before live filtering. By default instance live filtering (when requested, see -j) happens before instance ranking (when requested, see -J). With this option the logic is inverted and ranking happens before live filtering. flip the script. ๐Ÿ”„
  • -N predicate, --predicate=predicate โ€” Specify a comma-separated list of predicate filter reference metrics. By default ranking (see -J) happens for each metric individually. With predicates, ranking is done only for the specified predicate metrics. When reporting, rest of the metrics sharing the same instance domain (see PCPIntro(1)) as the predicate will include only the highest/lowest ranking instances of the corresponding predicate. Ranking does not imply sorting, see -6.

So for example, using proc.memory.rss (resident memory size of process) as the predicate metric together with proc.io.total_bytes and mem.util.used as metrics to be reported, only the processes using most/least (as per -J) memory will be included when reporting total bytes written by processes. Since mem.util.used is a single-valued metric (thus not sharing the same instance domain as the process related metrics), it will be reported as usual. ๐ŸŽฏ

  • -O origin, --origin=origin โ€” when we're reporting archived metrics, this is where you say "bestie, start reporting at origin inside the time window" (the time window being the -S / -T situation). The syntax for origin lives in PCPIntro(1), go check it there. ๐Ÿ•ฐ๏ธ
  • -p type, --es-search-type=type โ€” the Elasticsearch search type for measurements. That's it, that's the whole vibe. ๐Ÿ”
  • -P precision, --precision=precision โ€” use precision for your numeric non-integer output values. Default behaviour is 3 decimal places (when applicable, okay, when it even matters). Heads up: this will not override any possible per-metric specifications, so if a metric has its own opinion, that opinion wins. ๐Ÿ’…
  • -q scale, --count-scale=scale โ€” unit/scale for count metrics. Possible values include count x 10^-1, count, count x 10, count x 10^2, and so on and so forth all the way from 10^-8 to 10^7. > Careful: these values are currently space-sensitive. So don't get cute with the spacing. Also, this will not override possible per-metric specifications. See also pmParseUnitsStr(3). ๐Ÿ”ข
  • -Q scale, --count-scale-force=scale โ€” literally -q but it's the assertive version: this one will override per-metric specifications. Main character energy, no apologies. ๐Ÿ‘‘
  • -r, --raw โ€” output raw metric values, meaning do not convert cumulative counters to rates. This option will override possible per-metric specifications. Raw is raw. ๐ŸงŠ
  • -R, --raw-prefer โ€” like -r except it's polite about it: it will not override per-metric specifications. ๐Ÿซถ
  • -s samples, --samples=samples โ€” samples is how many samples you want retrieved and reported. If samples is 0, or if you just never passed -s at all, pcp2elasticsearch will sample and report continuously (that's real time mode) or until the end of the set of PCP archives (that's archive mode). See also -T. โ™พ๏ธ
  • -S starttime, --start=starttime โ€” when reporting archived metrics, your report gets restricted to only those records logged at or after starttime. Full syntax for starttime is over in PCPIntro(1). โฉ
  • -t interval, --interval=interval โ€” set the reporting interval to something other than the default of 1 second. The interval argument follows the syntax described in PCPIntro(1), and in the simplest form it can just be an unsigned integer (in which case the implied units are seconds). See also the -T option. โฑ๏ธ
  • -T endtime, --finish=endtime โ€” when reporting archived metrics, your report gets restricted to only those records logged before or at endtime. Full syntax for endtime lives in PCPIntro(1).

And when you use this to define the runtime before pcp2elasticsearch will exit: if no samples is given (peep -s) then the number of reported samples depends on interval (peep -t). If samples is given, then interval will get adjusted so it can report that many samples during the runtime. And in case all of -T, -s, and -t are given, endtime determines the actual time pcp2elasticsearch will run. So -T is holding the aux cord at that point. โน๏ธ

  • -v, --omit-flat โ€” report only set-valued metrics with instances (think disk.dev.read) and omit the single-valued "flat" metrics that have no instances (think kernel.all.sysfork). See -i and -I. ๐Ÿšซ
  • -V, --version โ€” display version number and exit. Simple, iconic. โœจ
  • -x index, --es-index=index โ€” Elasticsearch index for metric names. ๐Ÿ—‚๏ธ
  • -X hostid, --es-hostid=hostid โ€” Elasticsearch hostid for measurements. ๐Ÿท๏ธ
  • -y scale, --time-scale=scale โ€” unit/scale for time metrics. Possible values include nanosec, ns, microsec, us, millisec, ms, and so forth up to hour, hr. This option will not override possible per-metric specifications. See also pmParseUnitsStr(3). ๐Ÿ•
  • -Y scale, --time-scale-force=scale โ€” like -y but this one will override per-metric specifications. Yeah, she said what she said. ๐Ÿ’
  • -?, --help โ€” display usage message and exit. When in doubt, ask for help, bestie. ๐Ÿ™‹

๐Ÿ“ค OUTPUT FORMAT ๐Ÿ“ค

Okay so first thing's first: pcp2elasticsearch sends this type definition over to Elasticsearch:

{
    "mappings": {
        "properties": {
            "@timestamp": {
               "type": "long"
            },
            "host-id": {
            "type": "text"
            }
        }
    }
}

And the actual metrics data document? It's giving something like this:

{
    "@host-id": "bozo",
    "@timestamp": 1507637520,
    "mem": {
        "util": {
            "used": 4525820,
            "free": 3344000
        }
    },
    "disk": {
        "partitions": {
            "@instances": [
                {
                    "read": 1121,
                    "@id": "sda1"
                },
                {
                    "read": 77306,
                    "@id": "sda2"
                },
                {
                    "read": 131,
                    "@id": "sda3"
                }
            ]
        }
    }
}

๐Ÿ“ FILES ๐Ÿ“

  • pcp2elasticsearch.conf โ€” the pcp2elasticsearch configuration file (see -c). ๐ŸŽ€
  • $PCP_SYSCONF_DIR/pmrep/*.conf โ€” the system provided default pmrep configuration files. ๐ŸŒธ

๐ŸŒ PCP ENVIRONMENT ๐ŸŒ

Environment variables with the prefix PCP_ are used to parameterize the file and directory names that PCP uses. On every installation, the file /etc/pcp.conf contains the local values for these variables. And the $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5). ๐Ÿงญ

For environment variables affecting PCP tools, check pmGetOptions(3).

Of particular note: PCP_DISCRETE_ONCE can be set to ensure that discrete metric values are reported only once, unless they change at some point. ๐Ÿ‘€


๐Ÿ› DEBUGGING OPTIONS ๐Ÿ›

The -D or --debug option enables the output of additional diagnostics on stderr to help triage problems โ€” although ngl, the information is sometimes cryptic and primarily intended to provide guidance for developers rather than for end-users. ๐Ÿ˜ญ

debug is a comma separated list of debugging options; use pmdbg(1) with the -l option to obtain a list of the available debugging options and their meaning.


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

PCPIntro(1), mkaf(1), pcp(1), pcp2graphite(1), pcp2influxdb(1), pcp2json(1), pcp2spark(1), pcp2xlsx(1), pcp2xml(1), pcp2zabbix(1), pmcd(1), pminfo(1), pmrep(1), pmGetOptions(3), pmLoadDerivedConfig(3), pmParseUnitsStr(3), pmRegisterDerived(3), pmSpecLocalPMDA(3), LOGARCHIVE(5), pcp.conf(5), pmrep.conf(5) and PMNS(5).


And that's the whole page, bestie!! ๐Ÿ’– This one's from Performance Co-Pilot โ€” the PCP collection, dated PCP2ELASTICSEARCH(1). Go ship some metrics to Elasticsearch and slay. ๐Ÿฆ‹โœจ periodt. ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from