PMIE_CHECK(1)

πŸ“¦
version 7.2.2 Β· 4 versions
, in arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 PMIE_CHECK β€” the pmie_check(1) manual page, bestie edition 🌸

okay so this is the General Commands Manual page for pmie_check(1) and its sister pmie_daily, and honestly? it's giving "sysadmin but make it cute". stay with me, we're going through everything. πŸ’…


✨ NAME ✨

pmie_check, pmie_daily β€” the whole administration-and-management situation for the Performance Co-Pilot inference engine. that's the vibe. 🧚


πŸ¦‹ SYNOPSIS πŸ¦‹

$PCP_BINADM_DIR/pmie_check [-CNPpsTV?]  [-c control] [-l logfile]
$PCP_BINADM_DIR/pmie_daily [-NV?]  [-c control] [-k discard] [-l
logfile] [-m addresses] [-x compress] [-X program] [-Y regex]

πŸ’– DESCRIPTION πŸ’–

so basically there's this series of shell scripts + associated control files, and they exist so you can build your own customized little regime of administration and management for the Performance Co-Pilot inference engine β€” that's pmie(1) β€” and PCP itself, which is PCPIntro(1). 🫢

pmie_check can be run literally whenever, any time of day, and its whole job is to check that the set of pmie processes you want running is actually running. if something's missing? it (re-)starts the missing inference engine processes. no cap. ✨

pmie_daily is the once-a-day girlie. run it once per day, preferably in the early morning, as soon after midnight as is practical. her task is rotating the log files for the running pmie processes β€” because those files can grow without bound if the print action is used, or if literally any other pmie action writes to its stdout/stderr streams. 😭 and after some period, old pmie log files get discarded. bye bestie. πŸ—‘οΈ


πŸ‘‘ OPTIONS πŸ‘‘

the available command line options are, in order, no skipping:

  • -c control, --control=control β€” both pmie_check and pmie_daily are controlled by PCP inference engine control file(s), which specify the pmie instances to be managed. the default control file is $PCP_PMIECONTROL_PATH, but you can hand over an alternate with the -c option. and here's the tea: if the directory $PCP_PMLOGGERCONTROL_PATH.d (or control.d from the -c option) exists, then the contents of any additional control files in there get appended to the main control file β€” and that main control file must exist. periodt.
  • -C β€” this one makes pmie_check query the system service runlevel information for pmie, and use that to decide whether to start processes or not. let the system decide, iykyk. πŸ”₯
  • -k period, --discard=period β€” the log retention period is 14 days by default, but you can change it with this option. two special values are recognized for the discard period: 0 to keep no log files beyond the current one, and forever to prevent any log files being discarded at all. forever girlies, rise. πŸ’œ
  • -l file, --logfile=file β€” so that mail doesn't get unintentionally sent when these scripts run from cron(8), diagnostics are always sent to log files. by default those files are $PCP_LOG_DIR/pmie/pmie_daily.log and $PCP_LOG_DIR/pmie/pmie_check.log, but the -l option changes that. and heads up: if this log file already exists when the script starts, it gets renamed with a .prev suffix (overwriting any log file saved earlier 😳) before diagnostics are generated to the new log file.
  • -m addresses, --mail=addresses β€” using this option makes pmie_daily construct a summary of the log files generated for all monitored hosts in the last 24 hours (lines matching OK are culled), and e-mail that summary to the set of space-separated addresses. inbox moment. πŸ“
  • -N, --showme β€” enables a "show me" mode, where the programs' actions are echoed but not executed, in the style of make -n. using -N together with -V maximizes the diagnostic capabilities for debugging. chef's kiss. πŸ‘‘
  • -s, --stop β€” this gives you the reverse pmie_check functionality, letting the set of pmie processes be cleanly shut down. we love a clean exit. ✨
  • -p, --skip-primary β€” if you specify this for pmie_check, then any line from the control files for the primary pmie will be ignored. this is intended for environments where some system daemon, like systemd(1), is responsible for controlling the primary pmie (starting, stopping, restarting, etc.). let systemd have that one. πŸ’…
  • -P, --only-primary β€” if you specify this for pmie_check, then only the primary pmie entry in the control files will be processed. this is the logical opposite of the -p option above, and it's intended for RC scripts that start only the primary pmie, such as the pmie.service unit. 🚨 and listen: the -p and -P options to pmie_check are mutually exclusive. pick a lane, bestie.
  • -T, --terse β€” this option to pmie_check produces less verbose output than the default. most suitable for a pmie "farm" where many instances of pmie are expected to be running. quiet luxury. 🌸
  • -V, --verbose β€” the output from the cron execution of the scripts can be extended with -V, which enables verbose tracing of their activity. by default the scripts generate no output unless some error or warning condition is encountered. and again: using -N in conjunction with -V maximizes the diagnostic capabilities for debugging. πŸ”
  • -x period, --compress-after=period β€” log files can optionally be compressed after some period to conserve disk space. this is particularly useful for large numbers of pmie processes under the control of pmie_check. the -x option specifies the number of days after which to compress archive data files.
  • -X program, --compressor=program β€” specifies the program to use for compression β€” by default this is xz(1). ✨
  • -Y regex, --regex=regex β€” lets you specify a regular expression that causes files in the set of files matched for compression to be omitted. this means only the data file gets compressed, and it also stops the program from attempting to compress it more than once. the default regex is "\.(meta|index|Z|gz|bz2|zip|xz|lzma|lzo|lz4|zst)$" β€” such files are filtered using the -v option to egrep(1).
  • -?, --help β€” display the usage message and exit. the classic. πŸ™ˆ

🌈 CONFIGURATION 🌈

⚠️ Warning: the $PCP_PMIECONTROL_PATH and $PCP_PMIECONTROL_PATH.d files must not be writable by any user other than root. do not play with this one, fr fr. πŸ”’

the control file(s) should be customized according to the following rules, which define the current version (1.1) of the control file format:

  1. lines beginning with a # are comments. πŸ’¬
  2. lines beginning with a $ are assumed to be assignments to environment variables in the style of sh(1), and all text following the $ will be eval'ed by the script reading the control file, and the corresponding variable exported into the environment. this is particularly useful to set and export variables into the environment of the administrative script, e.g.
$ PMCD_CONNECT_TIMEOUT=20
  1. there must be a version line in the initial control file of the form:
$ version=1.1
  1. there should be one line in the control file(s) for each pmie instance, of the form:
host y|n y|n logfile args
  1. fields within a line of the control file(s) are separated by one or more spaces or tabs. 🫢
  2. the first field is the name of the host that is the default source of the performance metrics for this pmie instance.
  3. the second field indicates if this is a primary pmie instance (y) or not (n). since the primary inference engine must run on the local host, and there may be at most one primary for a particular host, this field can be y for at most one pmie instance β€” in which case the host name must be the name of the local host. when generating pmie configuration files, the primary clause indicates that pmieconf(1) should enable all rules in the primary group, in addition to all other default rules. main character energy only for one of them. πŸ‘‘
  4. the third field indicates whether this pmie instance needs to be started under the control of pmsocks(1) to connect to a pmcd through a firewall (y or n). πŸ”₯
  5. the fourth field is the name of the pmie activity log file. a useful convention is that pmie instances monitoring the local host with hostname myhost are maintained in the directory $PCP_LOG_DIR/pmie/myhost, while activity logs for the remote host mumble are maintained in $PCP_LOG_DIR/pmie/mumble. this is consistent with the way pmlogger(1) maintains its activity logs and archive files. consistency is the moment. ✨
  6. all other fields are interpreted as arguments to be passed to pmie(1). most typically this would be the -c option.

the following sample control lines specify one pmie instance monitoring the local host (wobbly), and another monitoring performance metrics from the host splat:

wobbly  n  PCP_LOG_DIR/pmie/wobbly  -c config.default
splat   n  PCP_LOG_DIR/pmie/splat   -c splat/cpu.conf

typical crontab(5) entries for periodic execution of pmie_daily and pmie_check are given in $PCP_SYSCONF_DIR/pmie/crontab (unless installed by default in /etc/cron.d already) and shown below:

# daily processing of pmie logs
08      0       *       *       *       $PCP_BINADM_DIR/pmie_daily
# every 30 minutes, check pmie instances are running
28,58   *       *       *       *       $PCP_BINADM_DIR/pmie_check

when using systemd(1) on Linux, no crontab entries are needed β€” the timer mechanism provided by systemd is used instead. slay. 🧚


the pmiectl(1) utility may invoke pmie_check using the sudo(1) command to run it under the $PCP_USER "pcp" account. and here's where it gets messy: if sudo is configured with the non-default requiretty option (see below), pmie_check may fail to run, due to not having a tty configured. 😭 this issue can be resolved by adding a second line (expand $PCP_BINADM_DIR according to your platform) to the /etc/sudoers configuration file as follows:

     Defaults requiretty
     Defaults!$PCP_BINADM_DIR/pmie_check !requiretty

note that the unprivileged PCP account under which these commands run uses /sbin/nologin as the shell, so the requiretty option is ineffective here and safe to disable in this way. problem solved, bestie. πŸ’…

πŸ“ FILES πŸ“

okay bestie, here's the map of where everything lives πŸ—ΊοΈβœ¨

  • $PCP_PMIECONTROL_PATH β€” this is the default PCP inference engine control file, the main character of the whole show πŸ’…
⚠️ Warning: this file must not be writable by any user other than root. Like, not even a little bit. Lock it down fr fr πŸ”’
  • $PCP_PMIECONTROL_PATH.d β€” an optional directory holding additional PCP inference engine control files, usually like one per host 🏠
⚠️ Warning: this files herein must not be writable by any user other than root. Same energy, same rule, no cap 🫢
  • $PCP_SYSCONF_DIR/pmie/crontab β€” a sample crontab for automated script execution by $PCP_USER (or root). Heads up: this one only exists if your platform doesn't support the /etc/cron.d mechanism πŸ•°οΈ
  • $PCP_VAR_DIR/config/pmie/config.default β€” the default pmie configuration file location for a localhost inference engine, and it's typically generated automatically by pmieconf(1) ✨
  • $PCP_LOG_DIR/pmie/pmie_check.log β€” default location for the pmie_check log file πŸ“ When it's run as a daemon service, if the pmie process failed to start or exited early, there may be error messages sitting in here β€” especially if the daemon could not open it's own log file 😭
  • $PCP_LOG_DIR/pmie/pmie_daily.log β€” default location for error messages generated during the daily pmie service maintenance operations 🧹
  • $PCP_LOG_DIR/pmie/<hostname> β€” default directory location for the pmie log file for the host hostname πŸ“‚
  • $PCP_LOG_DIR/pmie/<hostname>/lock β€” a transient lock file that guarantees mutual exclusion during pmie administration for the host hostname πŸ” If it's present, it can be safely removed as long as neither pmie_daily nor pmie_check are running. Do NOT just yeet it while they're live, bestie, that's chaos πŸ’€
  • $PCP_LOG_DIR/NOTICES β€” the PCP "notices" file, used by pmie(1) and friends πŸ“’

🌈 PCP ENVIRONMENT 🌈

So like, environment variables with the prefix PCP_ are what parameterize the file and directory names that PCP uses πŸŽ€ On each 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) ✨


πŸ‘€ SEE ALSO πŸ‘€

go read these next, i'm obsessed with cross-references honestly πŸ“šπŸ’–


and that's the whole page, bestie πŸŽ€πŸ’– you made it to the end, iconic behavior, no notes πŸ‘‘

this lil masterpiece comes to you from Performance Co-Pilot (that's the PCP crew πŸ¦‹), it's the PMIE_CHECK(1) page, and the date on it is the one stamped at the bottom of the original ✨

now go lock down your control files and stan a healthy inference engine πŸŒˆπŸ’…

πŸ“¦ where this page comes from