PCP2SPARK(1)

πŸ’– pcp2spark β€” the PCP-to-Spark glow-up πŸ’–

okay bestie, so this is PCP2SPARK(1), a General Commands Manual page, and it's literally the manual for pcp2spark. buckle up, it's a long one but we're gonna get through it together 🫢


✨ NAME ✨

pcp2spark β€” pcp-to-spark metrics exporter


🌸 SYNOPSIS 🌸

pcp2spark [-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
server] [-h host] [-i instances] [-J rank] [-K spec] [-N predicate] [-O
origin] [-p port] [-P|-0 precision] [-q|-Q count-scale] [-s samples] [-S
starttime] [-t interval] [-T endtime] [-y|-Y time-scale] metricspec
[...]

like, look at all those flags. she's got options, she's got range πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

pcp2spark is a customizable performance metrics exporter tool from PCP to Apache Spark. literally any available performance metric β€” live or archived, system and/or application β€” can be picked for exporting, and you can do the picking with either command line arguments or a configuration file. no cap.

so what's her whole deal? pcp2spark acts as a bridge, bestie. she provides a network socket stream on a given address/port, and an Apache Spark worker task can connect to that and pull the configured PCP metrics from pcp2spark, exporting them using the streaming extensions of the Apache Spark API. iconic behaviour honestly ✨

pcp2spark is a close relative of pmrep(1). so go refer to pmrep(1) for the metricspec description accepted on the pcp2spark command line. and see pmrep.conf(5) for the description of the pcp2spark.conf configuration file syntax. this page right here describes the pcp2spark specific options and configuration file differences with pmrep.conf(5). also, pmrep(1) lists some usage examples, and most of those are applicable with pcp2spark as well πŸ‘‘

real talk: only the command line options listed on this page are supported. other options available for pmrep(1) are not supported. don't come for her with extra flags πŸ’€

and here's the priority chain, super important:

  • 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).
  • Command line options override the corresponding configuration file options (if any).

command line wins. always. main character energy 🌟


🌈 GENERAL USAGE 🌈

A general setup for making use of pcp2spark would involve the user configuring pcp2spark for the PCP metrics to export, followed by starting the pcp2spark application. the pcp2spark application will then wait and listen on the given address/port for a connection from an Apache Spark worker thread to be started. the worker thread will then connect to pcp2spark. it's giving "she's waiting by the phone" energy 😭

When an Apache Spark worker thread has connected, pcp2spark will begin streaming PCP metric data to Apache Spark until the worker thread completes or the connection is interrupted. and if the connection is interrupted or the socket is closed from the Apache Spark worker thread, pcp2spark will exit. periodt.

For an example Apache Spark worker job which will connect to an pcp2spark instance on a given address/port and pull in PCP metric data, see the example provided in the PCP examples directory for pcp2spark (often provided by the PCP development package) or the online version at https://github.com/performancecopilot/pcp/blob/main/src/pcp2spark/. go look, it's right there 🫢


πŸŽ€ CONFIGURATION FILE πŸŽ€

pcp2spark 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 for compatibility. so like, she sees them, she just doesn't care πŸ™ˆ

πŸ’œ pcp2spark specific options πŸ’œ

  • spark_server (string) β€” Specify the address on which pcp2spark will listen for connections from an Apache Spark worker thread. The corresponding command line option is -g. Defaults to 127.0.0.1.
  • spark_port (integer) β€” Specify the port on which pcp2spark will listen for connections. The corresponding command line option is -p. Defaults to 44325.

⭐ OPTIONS ⭐

The available command line options are:

  • -0 precision, --precision-force=precision β€” Like -P but this option will override per-metric specifications. she said "no, my precision" πŸ’…
  • -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 pcp2spark. 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).
  • -5, --ignore-unknown β€” Silently ignore any metric name that cannot be resolved. At least one metric must be found for the tool to start. (she needs something to work with, bestie.)
  • -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. forceful. we love that for her πŸ”₯
  • -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.
  • -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.
  • --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).
  • -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.
  • -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: ./pcp2spark.conf, $HOME/.pcp2spark.conf, $HOME/pcp/pcp2spark.conf, and $PCP_SYSCONF_DIR/pcp2spark.conf. For details, see the above section and pmrep.conf(5).
  • --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. a little vibe check, then she's out ✌️
  • --daemonize β€” Daemonize on startup.
  • -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 server, --spark-server=server β€” pcp2spark local server address.
  • -G, --no-globals β€” Do not include global metrics in reporting (see pmrep.conf(5)).
  • -h host, --host=host β€” Fetch performance metrics from pmcd(1) on host, rather than from the default localhost.
  • -H, --no-header β€” Do not print any headers.
  • -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 a 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 pcp2spark 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.
  • -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.
  • -L, --local-PMDA β€” Use a local context to collect metrics from DSO PMDAs on the local host without PMCD. See also -K.
  • -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.
  • -N predicate, --predicate=predicate β€” bestie, this one is a whole vibe. Give it a comma-separated list of predicate filter reference metrics. Normally the ranking (that's -J, iykyk) happens for each metric individually. But with predicates, ranking only happens for the predicate metrics you named. And when it's reporting time, the rest of the metrics that share the same instance domain (peep PCPIntro(1)) as the predicate will only include the highest/lowest ranking instances of that predicate. Ranking does not imply sorting though β€” that's -6, don't get it twisted.

So fr, say you use proc.memory.rss (the resident memory size of a process) as the predicate metric, alongside proc.io.total_bytes and mem.util.used as the metrics being reported. Then only the processes using the most/least (as per -J) memory get included when reporting total bytes written by processes. And since mem.util.used is a single-valued metric (so it's not sharing the same instance domain as the process-related metrics), it just gets reported as usual. No drama. πŸ’…

  • -O origin, --origin=origin β€” when you're reporting archived metrics, start reporting at origin inside the time window (see -S and -T). For the complete description of the syntax for origin, go check PCPIntro(1). πŸ“–
  • -p port, --spark-port=port β€” pcp2spark local port. That's it, that's the whole thing. ✨
  • -P precision, --precision=precision β€” use precision for numeric non-integer output values. The default is 3 decimal places (when applicable). Heads up though: this option will not override possible per-metric specifications. πŸ™ˆ
  • -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 forth from 10^-8 to 10^7. (These values are currently space-sensitive, so watch your spaces bestie.) This option will not override possible per-metric specifications. See also pmParseUnitsStr(3). 🌈
  • -Q scale, --count-scale-force=scale β€” literally like -q, except this option will override per-metric specifications. She's assertive. πŸ‘‘
  • -r, --raw β€” output raw metric values, do not convert cumulative counters to rates. This option will override possible per-metric specifications.
  • -R, --raw-prefer β€” like -r, but this one will not override per-metric specifications. Softer approach, still valid. 🫢
  • -s samples, --samples=samples β€” the samples argument defines the number of samples to be retrieved and reported. If samples is 0 or -s isn't specified at all, pcp2spark will sample and report continuously (in real time mode) or until the end of the set of PCP archives (in archive mode). See also -T.
  • -S starttime, --start=starttime β€” when reporting archived metrics, the report gets restricted to those records logged at or after starttime. Refer to PCPIntro(1) for a complete description of the syntax for starttime.
  • -t interval, --interval=interval β€” set the reporting interval to something other than the default 1 second. The interval argument follows the syntax described in PCPIntro(1), and in the simplest form it may be an unsigned integer (the implied units in that case are seconds). See also the -T option. ⏰
  • -T endtime, --finish=endtime β€” when reporting archived metrics, the report gets restricted to those records logged before or at endtime. Refer to PCPIntro(1) for a complete description of the syntax for endtime.

When used to define the runtime before pcp2spark will exit: if no samples is given (see -s) then the number of reported samples depends on interval (see -t). If samples is given, then interval will be adjusted to allow reporting of samples during runtime. And in case all three of -T, -s, and -t are given, endtime determines the actual time pcp2spark will run. Periodt.

  • -v, --omit-flat β€” report only set-valued metrics with instances (e.g. disk.dev.read) and omit single-valued ``flat'' metrics without instances (e.g. kernel.all.sysfork). See -i and -I. πŸ¦‹
  • -V, --version β€” display version number and exit. Short, sweet, iconic. ✨
  • -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 option will override per-metric specifications. Again: assertive. πŸ’…
  • -?, --help β€” display usage message and exit. When in doubt, ask for help, that's growth. πŸŽ€

πŸ“ FILES πŸ“

  • pcp2spark.conf β€” pcp2spark configuration file (see -c). πŸ—‚οΈ
  • $PCP_SYSCONF_DIR/pmrep/*.conf β€” system provided default pmrep configuration files.

🌍 PCP ENVIRONMENT 🌍

Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. 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, see 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. So no repeats, only glow-ups. ✨


πŸ› DEBUGGING OPTIONS πŸ›

The -D or --debug option enables the output of additional diagnostics on stderr to help triage problems, although the information is sometimes cryptic and primarily intended to provide guidance for developers rather than for end-users. Ngl, it's giving dev-only. 😭

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. Go get that list bestie. πŸ”


πŸ‘€ SEE ALSO πŸ‘€

PCPIntro(1), mkaf(1), pcp(1), pcp2elasticsearch(1), pcp2graphite(1), pcp2influxdb(1), pcp2json(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, version PCP, and it's page PCP2SPARK(1) β€” go slay some metrics, no cap. βœ¨πŸ‘‘πŸŽ€

πŸ“¦ where this page comes from