PCP-CHECK(1)
πΈ NAME πΈ
pcp-check β manage the configuration of optional PCP components β¨
and yes bestie, this is the pcp-check(1) page, straight out of the General Commands Manual β buckle up π
β¨ SYNOPSIS β¨
$pcp-check [-a] [-d] [-l] [-n] [-s] [-v] [-x] [component ...]
$pcp-check [-a] [-c script]] [-d] [-l] [-n] [-s] [-v] [-x]
$PCP_BINADM_DIR/pmcheck ...
π DESCRIPTION π
okay so first thing: the Performance Co-Pilot (PCP) includes a whole bunch of core components that are likely already pre-configured and operational π«Ά but it ALSO includes a larger number of components that are not active by default. sleeping. dormant. not yet invited to the party π΄
In the context of pmcheck these components cover services that are typically started as part of the system boot procedure β e.g. pmcd(1), pmlogger(1), pmproxy(1), etc. β or optional Performance Metric Domain Agents (PMDAs) that augment the available performance metrics exported by pmcd(1). π
pmcheck lets you interrogate the state of components with the -s, --state option. Components can be activated with -a, --activate, or deactivated with -d, --deactivate. These three options are clearly mutually exclusive for any single execution of pmcheck, and in the absence of any of them, -s is assumed to be the default. periodt π
The set of components to be interrogated or configured is specified by the component name(s) from the command line, else all known components in the absence of any component arguments. When one or more component arguments are specified, these may optionally be sh(1) (glob) patterns that are matched against the names of the known components. π¦
The -l, --list option reports on known components. With one or more components, each is reported. Without any component arguments, the -l option lists all known components β which is simply all the component scripts (peep the COMPONENT SCRIPTS section below π) stored in the $PCP_SHARE_DIR/lib/pmcheck directory. If the -v option is also used, a short description of each requested component is also displayed. π
Additional components can be integrated into the pmcheck framework, and the -c, --file option allows an alternate sh(1) script to be used instead of a script associated with a known component. π§
In concert with the -a or -d options, the -n, --show-me option performs a dry run, showing the sh(1) commands that would be needed to perform the reconfiguration, but no reconfiguration is done. Commands that need to be run as ``root'' are prefixed with # and other commands are prefixed with $. π§
The -v, --verbose option increases reporting verbosity. π£οΈ
The -x, --trace option may be used specify that the component scripts are run with -x option to sh(1). This can assist with debugging the failure of a component script or during the development of a new component script, probably also involving the -c option to pmcheck. π
The -?, --help option displays a usage message. π
As a convience, pmcheck . is an alias for pcp-check. π«
π§© COMPONENT SCRIPTS π§©
The pmcheck framework is extensible, because the set of known components is defined by the names of the component scripts in the $PCP_SHARE_DIR/lib/pmcheck directory. ποΈ
Each component script needs to abide by the following rules for correct integration with pmcheck:
- The script will be run with
sh(1). If you need some other scripting language then you must provide ash(1)wrapper. - Since each script is responsible for one component, the name of the component is implied, however the name of the component is also passed from
pmcheckas the sole argument after the options. This allows generic component scripts to be implemented as hard links below$PCP_SHARE_DIR/lib/pmcheck. - When called with a
-l,--listoption the script does nothing, unless it is also called with a-voption, in which case a short description of the component is displayed on standard output. - When called with a
-s,--stateoption, the script must exit with the an exit code that indicates the component's state, namely0(active),1(inactive, but could be activated bypmcheck),2(inactive and cannot be activated bypmcheck). The distinction between exit codes1and2is based on many factors, but1usually means all of the required software packages (PCP and other) are installed, required prerequisite services are running or could be safely started, and any component configuration can assume default settings or can be reliably deduced, e.g. a port number for communications. Conversely,2means automatic activation of the component is not possible and some end-user intervention is required. - When called with a
-a,--activateoption the script must activate the component. This means making any required configuration change so that it is restarted at the next system reboot orpmcd(1)restart, and starting the component if it is currently inactive, - When called with a
-d,--deactivateoption the script must deactivate the component. This means stopping the component if it is currently active, and making any required configuration change so that it is not restarted at the next system reboot orpmcd(1)restart. - When called with a
-n,--show-meoption the script must perform a dry run and echo any required commands on standard output as per the rules described above for the-noption ofpmcheck. - If a
-v,--verboseoption is also specified, the script should provide explanatory text on standard output to help explain, particularly in cases where the component is not active or the reconfiguration failed.
To assist with component script development, the file $PCP_SHARE_DIR/lib/checkproc.sh may be sourced (after sourcing $PCP_DIR/etc/pcp.env). checkproc.sh provides the following services: π οΈ
- A temporary directory is created and the shell variable
$tmpis assigned to the full pathname of the directory. - The shell variable
$statusis used to return the exit status from the script [defaults to0]. - The shell variable
$componentis assigned to the associated component name. - The shell variable
$progis assigned to the script's basename (so the component name in the default case). - A trap is installed to cleanup
$tmpand exit with$status. - A
_do_argsshell procedure that handles all command argument parsing. - Shell variables
$aflag,$dflag,$lflagor$sflaghave default values offalseand are set totrueby_do_argswhen the-a,-d,-lor-soptions are parsed. - The shell variable
$show_mehas the default value offalseand is set totrueby_do_argswhen the-noption is parsed. - The shell variable
$verbosecounts number of-voptions parsed by_do_args. - A
_ctl_svcshell procedure that handles status requests and all reconfiguration operations for services that are managed bysystemctl(1)orinit(1)or similar infrastructure layers._ctl_svctakes 2 arguments, the first is an action (one ofstate,start,stop,activate(enable and start), ordeactivate(stop and disable), and the second is the name of the component; forsystemctl(1)managed components, name should be the basename of the service, e.g.pmcdfor thepmcd.servicesystemd(1)unit, otherwise name is the name of theinit(1)or similar ``rc'' script. _ctl_svcwill return a value (via$?when called from a shell script) that matches the exit codes defined above for each action.- A
_ctl_pmdashell procedure that handles status requests and all reconfiguration operations for a PMDA that is connected topmcd(1)._ctl_pmdatakes at least 2 arguments, the first is an action (one ofstate,activateordeactivate, and the second argument is the name of the PMDA. For theinstallaction, there is a third argument for the name of the PMDA's executable or DSO and an optional fourth argument is the name of a file providing the input required for the PMDA'sInstallscript (defaults to/dev/null). _ctl_pmdawill return a value (via$?when called from a shell script) that matches the exit codes defined above for each action.
So the following is the simplest possible component script for a system service. π£
#!/bin/sh
. $PCP_DIR/etc/pcp.env || exit 1
. $PCP_SHARE_DIR/lib/checkproc.sh
_do_args "$@"
if $lflag
then
[ $verbose -gt 0 ] && echo "my description"
elif $sflag
then
_ctl_svc state $component
status=$?
elif $aflag
then
_ctl_svc activate $component || status=1
elif $dflag
then
_ctl_svc deactivate $component || status=1
fi
And the following is the simplest possible component script for a PMDA. π₯
#!/bin/sh
. $PCP_DIR/etc/pcp.env || exit 1
. $PCP_SHARE_DIR/lib/checkproc.sh
_do_args "$@"
if $lflag
then
[ $verbose -gt 0 ] && echo "my description"
elif $sflag
then
_ctl_pmda state $component
status=$?
elif $aflag
then
_ctl_pmda activate $component || status=1
elif $dflag
then
_ctl_pmda deactivate $component || status=1
fi
π©Ί DIAGNOSTICS π©Ί
For pmcheck (not the component scripts) the exit status is typically 0, but values of 9 or 99 indicate serious internal botches. π
When the -a or -d options are used, the success or failure of the reconfiguration is reported on standard output. π’
β οΈ CAVEAT β οΈ
Some components have prerequisites that demand additional non-PCP services be installed, configured and operational, e.g. a database server or a key-value server. In these cases, probing the status of the non-PCP service may be subject to some access controls and if pmcheck is run as a non-root user, then the output from -s (the default) may be incomplete or misleading; in these circumstances, running pmcheck as root should provide a more accurate report. π
π 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). π
π SEE ALSO π
init(1), PCPIntro(1), pmcd(1), pmlogger(1), pmproxy(1), sh(1), systemctl(1), pcp.conf(5) and pcp.env(5).
and that's the whole page bestie π«Ά this came to you from the Performance Co-Pilot era of the PCP chronicles, filed under PCP-CHECK(1) β go configure something iconic, mwah π
β¨π
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- centos-stream 9: pcp-doc 6.3.7-14.el9 Β· GPL-2.0-or-later AND CC-BY-3.0
- debian trixie: pcp 6.3.8-1
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu questing: pcp 6.3.8-1
- ubuntu resolute: pcp 7.1.1-1
- ubuntu stonking: pcp 7.2.1-2build1
- Copyright (c) 2024 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms