PMIE(1)
๐ PMIE(1) ๐
General Commands Manual โจ PMIE(1)
โจ NAME โจ
pmie โ inference engine for performance metrics ๐ง ๐
๐ฆ SYNOPSIS ๐ฆ
pmie [-bCdeFfPqvVWxXz?] [-a archive] [-A align] [-c config] [-D debug]
[-h host] [-l logfile] [-m note] [-j stompfile] [-n pmnsfile] [-o
format] [-O offset] [-S starttime] [-t interval] [-T endtime] [-U
username] [-Z timezone] [filename ...]
๐ธ DESCRIPTION ๐ธ
okay so bestie, listen up. pmie takes a whole collection of arithmetic, logical, and rule expressions and evaluates them at whatever frequencies you tell it. that's the whole gig. ๐โโ๏ธ
the base data for all those expressions? it's performance metrics values, delivered in real-time from any host running the Performance Metrics Collection Daemon (PMCD), or from historical data pulled out of Performance Co-Pilot (PCP) archives. both vibes are valid.
and it's not just math, no no. as well as computing arithmetic and logical values, pmie can execute actions in response to specified conditions โ popup alarms, write system log messages, and launch programs. iconic behavior fr fr. these actions are extremely useful for detecting, monitoring and correcting performance related problems. main character energy for your servers. ๐
the expressions to be evaluated are read from configuration files specified by one or more filename arguments. and if there's no filename at all? expressions get read from standard input. no file, no problem. ๐ซถ
output from pmie goes to standard output and standard error like this:
โจ stdout โจ
Expression values printed in the verbose -v mode and the output of print actions. ๐
โจ stderr โจ
Error and warning messages for any syntactic or semantic problems during expression parsing, and any semantic or performance metrics availability problems during expression evaluation. ๐ญ
๐ OPTIONS ๐
the available command line options are โ buckle up bestie, there's a lot and they're all important:
-aarchive,--archive=archive โ archive 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 written bypmlogger(1). Multiple instances of the-aflag may appear on the command line to specify a list of sets of archives. In this case, it is required that only one set of archives be present for any one host. Also, any explicit host names occurring in apmieexpression must match the host name recorded in one of the archive labels. In the case of multiple sets of archives, timestamps recorded in the archives are used to ensure temporal consistency. โฐ-Aalign,--align=align โ Force the initial time window to be aligned on the boundary of a natural time unit align. Refer toPCPIntro(1)for a complete description of the syntax for align. ๐-b,--bufferโ Output will be line buffered and standard output is attached to standard error. This is most useful for background execution in conjunction with the-loption. The-boption is always used forpmieinstances launched frompmie_check(1). ๐งบ-cconfig,--config=config โ An alternative to specifying filename at the end of the command line. ๐-C,--checkโ Parse the configuration file(s) and exit before performing any evaluations. Any errors in the configuration file are reported. ๐ต๏ธโโ๏ธ-d,--interactโ Normallypmiewould be launched as a non-interactive process to monitor and manage the performance of one or more hosts. Given the-dflag however, execution is interactive and the user is presented with a menu of options. Interactive mode is useful mainly for debugging new expressions. ๐ฎ-e,--timestampโ When used with-V,-vor-W, this option forces timestamps to be reported with each expression. The timestamps are inctime(3)format, enclosed in parenthesis and appear after the expression name and before the expression value, e.g.
expr_1 (Tue Feb 6 19:55:10 2001): 12
-f,--foregroundโ If the-loption is specified and there is no-aoption (i.e. real-time monitoring) thenpmieis run as a daemon in the background (in all other cases foreground is the default). The-f(and-F, see below) options forcepmieto be run in the foreground, independent of any other options. ๐โโ๏ธ-F,--systemdโ Like-f, the-Foption runspmiein the foreground, but also does some housekeeping (like create a pid file, change user id and notifysystemd(1)whenpmiehas started or is shutting down). This is intended for use whenpmieis launched fromsystemd(1)and the daemonising has already been done. The-fand-Foptions are mutually exclusive. ๐ซ-hhost,--host=host โ By default performance data is fetched from the local host (in real-time mode) or the host for the first named set of archives on the command line (in archive mode). The host argument overrides this default. It does not override hosts explicitly named in the expressions being evaluated. The host argument is interpreted as a connection specification forpmNewContext, and is later mapped to the remotepmcd's self-reported host name for reporting purposes. See also the%hvs.%csubstitutions in rule action strings below. ๐-jfile โ An alternative STOMP protocol configuration is loaded from stompfile. If this option is not used, and thestompaction is used in any rule, the default location$PCP_SYSCONF_DIR/pmie/config/stompwill be used. ๐ฎ-llogfile,--logfile=logfile โ Standard error is sent to logfile. ๐-mnote,--note=note โ Used to indicate wherepmiehas been launched from, e.g.pmie_check(1)andpmie_daily(1)use-m pmie_checkand this is used bypmieto determine if it needs to be restarted should the PMCD hostname change, as described in the HOSTNAME CHANGES section below. ๐ท๏ธ-npmnsfile,--namespace=pmnsfile โ An alternative Performance Metrics Name Space (PMNS) is loaded from the file pmnsfile. ๐๏ธ-oformat,--format=format โ When precessing performance data from an archive, the-ooption may be used to specify an alternate output format when a rule action is executed. See the DIFFERENCES IN HOST AND ARCHIVE MODES section for a description of how the output format may be constructed. ๐จ-Oorigin,--origin=origin โ Specify the origin of the time window. SeePCPIntro(1)for complete description of this option. โณ-P,--primaryโ Identifies this as the primarypmieinstance for a host. See the ``AUTOMATIC RESTART'' section below for further details. ๐ฅ-q,--quietโ Suppresses diagnostic messages that would be printed to standard output by default, especially the "evaluator exiting" message as this can confuse scripts. ๐คซ-Sstarttime,--start=starttime โ Specify the starttime of the time window. SeePCPIntro(1)for complete description of this option. ๐ฆ-tinterval,--interval=interval โ The interval argument follows the syntax described inPCPIntro(1), and in the simplest form may be an unsigned integer (the implied units in this case are seconds). The value is used to determine the sample interval for expressions that do not explicitly set their sample interval using thepmievariabledeltadescribed below. The default is 10.0 seconds. โฑ๏ธ-Tendtime,--finish=endtime โ Specify the endtime of the time window. SeePCPIntro(1)for complete description of this option. ๐-Uusername,--username=username โ User account under which to runpmie. The default is the current user account for interactive use. When run as a daemon, the unprivileged"pcp"account is used in current versions of PCP, but in older versions the superuser account ("root") was used by default. ๐ค-vโ Unless one of the verbose options-V,-vor-Wappears on the command line, expressions are evaluated silently, the only output is as a result of any actions being executed. In the verbose mode, specified using the-vflag, the value of each expression is printed as it is evaluated. The values are in canonical units; bytes in the dimension ofspace'', seconds in the dimension oftime'' and events in the dimension of ``count''. SeepmLookupDesc(3)for details of the supported dimension and scaling mechanisms for performance metrics. The verbose mode is useful in monitoring the value of given expressions, evaluating derived performance metrics, passing these values on to other tools for further processing and in debugging new expressions. ๐ฃ๏ธ-V,--verboseโ This option has the same effect as the-voption, except that the name of the host and instance (if applicable) are printed as well as expression values. ๐จ๏ธ-Wโ This option has the same effect as the-Voption described above, except that for boolean expressions, only those names and values that make the expression true are printed. These are the same names and values accessible to rule actions as the%h,%i,%cand%vbindings, as described below. โ-x,--secret-agentโ Execute in domain agent mode. This mode is used within the Performance Co-Pilot product to derive values for summary metrics, seepmdasummary(1). Only restricted functionality is available in this mode (expressions with actions may not be used). ๐ถ๏ธ-X,--secret-appletโ Run in secret applet mode (thin client). ๐คซ๐ป-z,--hostzoneโ Change the reporting timezone to the timezone of the host that is the source of the performance metrics, as identified via either the-hoption or the first named set of archives (as described above for the-aoption). ๐-Ztimezone,--timezone=timezone โ Change the reporting timezone to timezone in the format of the environment variableTZas described inenviron(7). ๐ฐ๏ธ-?,--helpโ Display usage message and exit. โ
๐ EXAMPLES ๐
okay bestie, these example expressions are here to show off what the inference engine can actually do. it's giving demo reel. โจ
the directory $PCP_DEMOS_DIR/pmie has a bunch of other annotated examples of pmie expressions if you wanna go browse, no cap.
the variable delta controls expression evaluation frequency. so if you want subsequent expressions evaluated once a second, until further notice:
delta = 1 sec;
if the total context switch rate exceeds 10000 per second per CPU, display an alarm notifier:
kernel.all.pswitch / hinv.ncpu > 10000 count/sec
-> alarm "high context switch rate %v";
if that high context switch rate is sustained for 10 consecutive samples, then launch top(1) in an xterm(1) window to monitor processes โ but like, do this at most once every 5 minutes, we're not trying to spam ourselves:
all_sample (
kernel.all.pswitch @0..9 > 10 Kcount/sec * hinv.ncpu
) -> shell 5 min "xterm -e 'top'";
the following rules are evaluated once every 20 seconds:
delta = 20 sec;
if any disk is performing more than 60 I/Os per second, print a message identifying the busy disk to standard output and launch dkvis(1):
some_inst (
disk.dev.total > 60 count/sec
) -> print "busy disks:" " %i" &
shell 5 min "dkvis";
refine that preceding rule so it only applies between the hours of 9am and 5pm, and requires 3 of 4 consecutive samples to exceed the threshold before executing the action:
$hour >= 9 && $hour <= 17 &&
some_inst (
75 %_sample (
disk.dev.total @0..3 > 60 count/sec
)
) -> print "disks busy for 20 sec:" " [%h]%i";
the following two rules are evaluated once every 10 minutes:
delta = 10 min;
if either the / or the /usr filesystem is more than 95% full, display an alarm popup โ but not if it's already been displayed during the last 4 hours:
filesys.free #'/dev/root' /
filesys.capacity #'/dev/root' < 0.05
-> alarm 4 hour "root filesystem (almost) full";
filesys.free #'/dev/usr' /
filesys.capacity #'/dev/usr' < 0.05
-> alarm 4 hour "/usr filesystem (almost) full";
the following rule needs a machine that supports the lmsensors metrics. if the machine environment temperature rises more than 2 degrees over a 10 minute interval, write an entry in the system log:
lmsensors.coretemp_isa.temp1 @0 - lmsensors.coretemp_isa.temp1 @1 > 2
-> alarm "temperature rising fast" &
syslog "machine room temperature rise alarm";
and here's something interesting if you've got performance problems with your Oracle database ๐ซถ:
// back to 30sec evaluations
delta = 30 sec;
sid = "ptg1"; # $ORACLE_SID setting
lid = "223"; # latch ID from v$latch
lru = "#'$sid/$lid cache buffers lru chain'";
host = ":moomba.melbourne.sgi.com";
gets = "oracle.latch.gets $host $lru";
total = "oracle.latch.gets $host $lru +
oracle.latch.misses $host $lru +
oracle.latch.immisses $host $lru";
$total > 100 && $gets / $total < 0.2
-> alarm "high lru latch contention in database $sid";
the following ruleset will emit exactly one message depending on the availability and value of the 1-minute load average:
delta = 1 minute;
ruleset
kernel.all.load #'1 minute' > 10 * hinv.ncpu ->
print "extreme load average %v"
else kernel.all.load #'1 minute' > 2 * hinv.ncpu ->
print "moderate load average %v"
unknown ->
print "load average unavailable"
otherwise ->
print "load average OK"
;
the following rule will emit a message when some filesystem is more than 75% full and is filling at a rate that โ if sustained โ would fill the filesystem to 100% in less than 30 minutes:
some_inst (
100 * filesys.used / filesys.capacity > 75 &&
filesys.used + 30min * (rate filesys.used) > filesys.capacity
) -> print "filesystem will be full within 30 mins:" " %i";
if the metric mypmda.errors counts errors, then the following rule will emit a message if the rate of errors exceeds 1 per second โ provided the error count is less than 100:
mypmda.errors > 1 && instant mypmda.errors < 100
-> print "high error rate: %v";
๐ QUICK START ๐
ngl, the pmie specification language is powerful and large. like, a lot.
to expedite rapid development of pmie rules, the pmieconf(1) tool provides a facility for generating a pmie configuration file from a set of generalized pmie rules. the supplied set of rules covers a wide range of performance scenarios. obsessed. ๐
the Performance Co-Pilot User's and Administrator's Guide provides a detailed tutorial-style chapter covering pmie. go read it bestie.
๐ฆ EXPRESSION SYNTAX ๐ฆ
okay so this description is terse and informal โ for a more comprehensive description, see the Performance Co-Pilot User's and Administrator's Guide.
a pmie specification is a sequence of semicolon terminated expressions. periodt.
the sequence ``//'' introduces a comment, and all text from here to the end of the current input line will be ignored. ๐
basic operators are modeled on the arithmetic, relational and Boolean operators of the C programming language. precedence rules are as expected, although the use of parentheses is encouraged to enhance readability and remove ambiguity. yes queen, use your parens.
operands are performance metric names (see PMNS(5)) and the normal literal constants.
operands involving performance metrics may produce sets of values, as a result of enumeration in the dimensions of hosts, instances and time. special qualifiers may appear after a performance metric name to define the enumeration in each dimension. for example:
kernel.percpu.cpu.user :foo :bar #cpu0 @0..2
defines 6 values corresponding to the time spent executing in user mode on CPU 0 on the hosts foo'' and bar'' over the last 3 consecutive samples. the default interpretation in the absence of : (host), # (instance) and @ (time) qualifiers is all instances at the most recent sample time for the default source of PCP performance metrics.
host and instance names that don't follow the rules for variables in programming languages โ i.e. alphabetic optionally followed by alphanumerics โ should be enclosed in single quotes.
expression evaluation follows the law of least surprises''. where performance metrics have the semantics of a counter, `pmie` will automatically convert to a **rate** based upon consecutive samples and the time interval between these samples. all numeric expressions are evaluated in **double precision**, and where appropriate, automatically scaled into canonical units of bytes'', seconds'' and counts''. note that metrics defined over extra units like temperature'' or voltage'' are not scaled into canonical units. ๐
a rule is a special form of expression that specifies a condition or logical expression, a special operator (->) and actions to be performed when the condition is found to be true.
the following table summarizes the basic pmie operators:
+ - * /โ Arithmetic< <= == >= > !=โ Relational (value comparison)! && ||โ Boolean->โ Rulerisingโ Boolean, false to true transitionfallingโ Boolean, true to false transitionrateโ Explicit rate conversion (rarely required)instantโ No automatic rate conversion (rarely required)
all operators are supported for numeric-valued operands and expressions. for string-valued operands โ namely literal string constants enclosed in double quotes, or metrics with a data type of string (PM_TYPE_STRING) โ only the operators == and != are supported.
the rate and instant operators are the logical inverse of one another, so an arithmetic expression expr is equal to rate instant expr. the more useful cases involve using rate with a metric that is not a counter to determine the rate of change over time, or instant with a metric that is a counter to determine if the current value is above or below some threshold.
aggregate operators may be used to aggregate or summarize along one dimension of a set-valued expression. the following aggregate operators map from a logical expression to a logical expression of lower dimension.
Okay bestie, real talk โ sometimes you don't want one host's answer, you want the โจwhole squad'sโจ answer collapsed into one vibe. Enter the set-valued logical operators ๐ซถ
some_inst,some_host,some_sampleโ Existential โ true if at least one set member is true in the associated dimension. one (1) single member. that's it. that's the bar.all_inst,all_host,all_sampleโ Universal โ true if all set members are true in the associated dimension. everyone has to show up to the function, no exceptions ๐N%_inst,N%_host,N%_sampleโ Percentile โ true if at least N percent of set members are true in the associated dimension. a solid majority, if you will.
Now for the filter girlies. These instantial operators let you filter or limit a set-valued logical expression, based on regular expression matching of instance names. Two things to know going in: the logical expression must be a set involving the dimension of instances, and the regular expression is of the form used by egrep(1) or the Extended Regular Expressions of regcomp(3).
match_instโ for each value of the logical expression that istrue, the result istrueif the associated instance name matches the regular expression. Otherwise the result isfalse.nomatch_instโ for each value of the logical expression that istrue, the result istrueif the associated instance name does not match the regular expression. Otherwise the result isfalse.
For example, the expression below will be true for disks attached to controllers 2 or 3 performing more than 20 operations per second:
match_inst "^dks[23]d" disk.dev.total > 20;
Next up: the aggregate operators, which map from an arithmetic expression to an arithmetic expression of lower dimension. glow down, but make it math ๐ฆ
min_inst,min_host,min_sampleโ Extrema โ minimum value across all set members in the associated dimension.max_inst,max_host,max_sampleโ Extrema โ maximum value across all set members in the associated dimension.sum_inst,sum_host,sum_sampleโ Aggregate โ sum of values across all set members in the associated dimension.avg_inst,avg_host,avg_sampleโ Aggregate โ average value across all set members in the associated dimension.
And the count girlies: the aggregate operators count_inst, count_host and count_sample map from a logical expression to an arithmetic expression of lower dimension by counting the number of set members for which the expression is true in the associated dimension. yes bestie, they count. that's the whole job and they do it flawlessly ๐
Now, for action rules, here are the actions that are defined:
alarmโ raise a visible alarm withxconfirm(1)printโ display on standard outputshellโ execute withsh(1)stompโ send a STOMP message to a JMS serversyslogโ append a message to system log file
Multiple actions may be separated by the & and | operators, which specify respectively sequential execution (both actions are executed) and alternate execution (the second action will only be executed if the execution of the first action returns a non-zero error status).
Arguments to actions are an optional suppression time, and then one or more expressions (a string is an expression in this context). Strings appearing as arguments to an action may include the following special selectors that will be replaced at the time the action is executed.
%hโ Host name(s) that make the left-most top-level expression in the condition true.%cโ Connection specification string(s) or files for a PCP tool to reach the hosts or archives that make the left-most top-level expression in the condition true.%iโ Instance(s) that make the left-most top-level expression in the condition true.%vโ One value from the left-most top-level expression in the condition for each host and instance pair that makes the condition true.
Heads up bestie, this next bit is the one that trips people: expansion of the special selectors is done by repeating the whole argument once for each unique binding to any of the qualifying special selectors. not the selector โ the whole. entire. argument. ๐
So like, say a rule were true for the host mumble with instances grunt and snort, and for host fumble the instance puff makes the rule true. Then the action
...
-> shell myscript "Warning: %h:%i busy ";
will execute myscript with the argument string "Warning: mumble:grunt busy Warning: mumble:snort busy Warning: fumble:puff busy".
By comparison, if the action
...
-> shell myscript "Warning! busy:" " %h:%i";
were executed under the same circumstances, then myscript would be executed with the argument string "Warning! busy: mumble:grunt mumble:snort fumble:puff".
See what happened there? ๐ The semantics of the expansion of the special selectors leads to a common usage pattern in an action, where one argument is a constant (contains no special selectors), the second argument contains the desired special selectors with minimal separator characters, and an optional third argument provides a constant postscript (e.g. to terminate any argument quoting from the first argument). If necessary, post-processing (e.g. in myscript) can provide the necessary enumeration over each unique expansion of the string containing just the special selectors.
For complex conditions, the bindings to these selectors is not obvious. It is strongly recommended that pmie be used in the debugging mode (specify the -W command line option in particular) during rule development. fr fr, do not skip this step, your future self will thank you ๐โจ
๐ง BOOLEAN EXPRESSIONS โจ
ok so bestie, some pmie expressions just are Boolean by nature โ like foo.bar > 10 or some_inst ( my.table < 0 ) โ and those get assigned one of three values: true, false, or unknown. periodt.
And when does something land on unknown? When one or more of the underlying metric values just isn't there. Like:
pmcd(1)on the host cannot be contacted ๐ญ- the metric is not in the PCP archive
- no values are currently available
- insufficient values have been fetched to allow a rate converted value to be computed
- insufficient values have been fetched to instantiate the required number of samples in the temporal domain
When you combine values that include unknown, the Boolean operators follow the normal rules of Kleene logic (aka 3-valued logic). here's the whole vibe, literally:
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ B โ
โ A and B โโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโโค
โ โ true โ false โ unknown โ
โโโโโฌโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโค
โ โ true โ true โ false โ unknown โ
โ โโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโค
โ A โ false โ false โ false โ false โ
โ โโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโค
โ โ unknown โ unknown โ false โ unknown โ
โโโโโดโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ B โ
โ A or B โโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโค
โ โ true โ false โ unknown โ
โโโโโฌโโโโโโโโโโผโโโโโโโผโโโโโโโโโโผโโโโโโโโโโค
โ โ true โ true โ true โ true โ
โ โโโโโโโโโโโผโโโโโโโผโโโโโโโโโโผโโโโโโโโโโค
โ A โ false โ true โ false โ unknown โ
โ โโโโโโโโโโโผโโโโโโโผโโโโโโโโโโผโโโโโโโโโโค
โ โ unknown โ true โ unknown โ unknown โ
โโโโโดโโโโโโโโโโดโโโโโโโดโโโโโโโโโโดโโโโโโโโโโ
โโโโโโโโโโโฌโโโโโโโโโโ
โ A โ not A โ
โโโโโโโโโโโผโโโโโโโโโโค
โ true โ false โ
โโโโโโโโโโโผโโโโโโโโโโค
โ false โ true โ
โโโโโโโโโโโผโโโโโโโโโโค
โ unknown โ unknown โ
โโโโโโโโโโโดโโโโโโโโโโ
๐ RULESETS ๐
The ruleset clause is how you define a little squad of rules and actions that get evaluated in order โ and the second one of them actually executes an action, everything after it just gets skipped, until the ruleset gets scheduled for evaluation again. the way that works is so clean honestly.
The keyword else is what separates rules. ๐ธ
And after you've got one or more regular rules (each with a predicate and an action), a ruleset may include an optional
unknown -> action
clause, optionally followed by a
otherwise -> action
clause.
So like, what happens:
- If all of the predicates in the rules evaluate to
unknownand anunknownclause has been specified, then the action associated with theunknownclause will be executed. ๐ - If no rule predicate is true and the unknown action is either not specified or not executed, and an
otherwiseclause has been specified, then the action associated with theotherwiseclause will be executed.
๐ SCALE FACTORS ๐
Scale factors may be appended to arithmetic expressions, and they force linear scaling of the value to canonical units. iconic.
Simple scale factors are constructed from these keywords: nanosecond, nanosec, nsec, microsecond, microsec, usec, millisecond, millisec, msec, second, sec, minute, min, hour, byte, Kbyte, Mbyte, Gbyte, Tbyte, count, Kcount and Mcount โ plus the operator /. For example, ``Kbytes / hour''. ๐ฆ
Now, metrics defined over extra units like temperature'' or voltage'' may have a very wide variety of possible scales, and ngl there is no support in pmie for keywords to effect scaling, so expressions have to use explicit scaling instead, e.g.
this.temp.celsius >= (other.temp.fahrenheit - 32) * 5 / 9
๐ MACROS ๐
Macros are defined using expressions of the form:
name = constexpr;
Where name follows the normal rules for variables in programming languages, i.e. alphabetic optionally followed by alphanumerics. And constexpr must be a constant expression โ either a string (enclosed in double quotes) or an arithmetic expression optionally followed by a scale factor. no cap.
Macros are expanded when their name, prefixed by a dollar ($), appears in an expression, and macros may be nested within a constexpr string. yes bestie, nesting. we love to see it. ๐ซถ
The following reserved macro names are understood:
minuteโ Current minute of the hour.hourโ Current hour of the day, in the range 0 to 23.dayโ Current day of the month, in the range 1 to 31.monthโ Current month of the year, in the range 0 (January) to 11 (December).yearโ Current year.day_of_weekโ Current day of the week, in the range 0 (Sunday) to 6 (Saturday).deltaโ Sample interval in effect for this expression.
Dates and times are presented in the reporting time zone (see description of -Z and -z command line options above). โญ
๐ AUTOMATIC RESTART ๐
It is often useful for pmie processes to be started and stopped when the local host is booted or shutdown, or when they have been detected as no longer running (like when they have unexpectedly exited for some reason ๐). Refer to pmie_check(1) for details on automating this process.
Optionally, each system running pmcd(1) may also be configured to run a ``primary'' pmie instance. This pmie instance is launched by $PCP_RC_DIR/pmie, and is affected by the files $PCP_SYSCONF_DIR/pmie/control, $PCP_SYSCONF_DIR/pmie/control.d (use chkconfig(8), systemctl(1) or similar platform-specific commands to activate or disable the primary pmie instance) and $PCP_VAR_DIR/config/pmie/config.default (the default initial configuration file for the primary pmie).
The primary pmie instance is identified by the -P option. There may be at most one ``primary'' pmie instance on each system. ๐
The primarypmieinstance (if any) must be running on the same host as thepmcd(1)to which it connects (if any), so the-hand-Poptions are mutually exclusive. ๐ don't try it.
๐ก EVENT MONITORING ๐ก
It is common for production systems to be monitored in a central location. Traditionally on UNIX systems this has been performed by the system log facilities โ see logger(1), and syslogd(1). On Windows, communication with the system event log is handled by pcp-eventlog(1).
pmie fits into this model when rules use the syslog action. Note that if the action string begins with -p (priority) and/or -t (tag) then these are extracted from the string and treated in the same way as in logger(1) and pcp-eventlog(1). โจ
However, it is common to have other event monitoring frameworks also, into which you may wish to incorporate performance events from pmie. You can often use the shell action to send events to these frameworks, as they usually provide their a program for injecting events into the framework from external sources.
A final option is use of the stomp (Streaming Text Oriented Messaging Protocol) action, which allows pmie to connect to a central JMS (Java Messaging System) server and send events to the PMIE topic. Tools can be written to extract these text messages and present them to operations people (via desktop popup windows, etc). ๐ Use of the stomp action requires a stomp configuration file to be setup, which specifies the location of the JMS server host, port number, and username/password.
The format of this file is as follows:
host=messages.sgi.com # this is the JMS server (required)
port=61616 # and its listening here (required)
timeout=2 # seconds to wait for server (optional)
username=joe # (required)
password=j03ST0MP # (required)
topic=PMIE # JMS topic for pmie messages (optional)
The timeout value specifies the time (in seconds) that pmie should wait for acknowledgements from the JMS server after sending a message (as required by the STOMP protocol). Note that on startup, pmie will wait indefinitely for a connection, and will not begin rule evaluation until that initial connection has been established. ๐ญ
Should the connection to the JMS server be lost at any time while pmie is running, pmie will attempt to reconnect on each subsequent truthful evaluation of a rule with a stomp action, but not more than once per minute. This is to avoid contributing to network congestion. ๐ง In this situation, where the STOMP connection to the JMS server has been severed, the stomp action will return a non-zero error value.
๐ฆ DIFFERENCES IN HOST AND ARCHIVE MODES ๐ฆ
ok so this is the part where the vibes change depending on where you're running, and honestly it's giving two completely different girls ๐
When you're in host mode, the delta interval for each rule is a real-time delay between rule evaluations โ so pmie spends most of its time just... sleeping ๐ด waiting for the next scheduled rule evaluation to roll around. main character energy of a girl who naps between classes fr.
When you're in archive mode, pmie uses the delta interval for each rule to figure out how frequently the rules get evaluated against the archive data, but โ and this is the key part โ unlike host mode there are no real-time delays, because the archive gets ``replayed'' as fast as possible. no waiting around, we're speedrunning ๐โโ๏ธ๐จ
In archive mode, when a rule predicate evaluates true, the action gets modified. So instead of posting to syslog or raising a visible alarm or running a shell command or sending a stomp message, pmie prints:
- the name of the action
- the timestamp from the archive when the rule predicate triggering the action was true
- all of the arguments that would have been passed to the real action in host mode
Like, imagine the rule:
delta = 10 sec;
kernel.all.nprocs > 10 * hinv.ncpu -> print "lotsaprocs:" " %v";
when you run that against an archive, the output is literally:
print Mon Sep 4 00:10:21 2017: lotsaprocs: 1292
print Mon Sep 4 00:10:31 2017: lotsaprocs: 1294
print Mon Sep 4 00:10:41 2017: lotsaprocs: 1291
...
โจ cute, right? but also โ why tho? The rationale (per the original, bestie, I'm not making this up) is that the context in which the action would have been executed (in host mode) was at a time in the past, and possibly on a different host (if the archive was collected from one host, but pmie is being run on a different host). So flooding syslog with misleading messages, or an avalanche of visual alarms, or a lot of STOMP messages, or a shell command that might not even work on the host where pmie is being run โ those are all examples of ``badness'' to be avoided ๐ซ Rather, the output is text in a regular format suitable for post-processing with a range of filters and performance analysis tools. very data science girlie of it.
The output format can be changed using the -o option, which consists of literal characters with the following embedded ``meta-field'' tokens:
%aโ The name of the action, e.g.print,syslog, etc.%dโ The date and time inctime(3)format when the action would have been executed.%fโ The name of the configuration file containing the action being executed, else<stdin>if the rules were read from standard input.%lโ The (approximate) line number in the configuration file for the action being executed.%mโ The message component of the action.%uโ The date and time when the action would have been executed in extendedctime(3)format with microsecond precision for the time.%%โ A literal percent character.
The default output format is equivalent to a format of %a %d: %m. periodt โจ
๐ SIGNALS ๐
If pmie is sent a SIGHUP signal, the logfile will be closed, unlinked and re-opened. This is used by pmie_daily(1) to achieve nightly log rotation. glow-up every night at midnight, we love a self-care routine ๐
Most of the time pmie is sleeping, waiting until the next set of rules needs to be evaluated. Sending pmie a SIGUSR1 signal will cause the details for the next set of rules to be dumped on logfile, including how long the current sleep is and how much time remains. The scheduling of rules is not changed by this action. so like, a little peek at her calendar without actually moving anything around ๐ซถ
๐ HOSTNAME CHANGES ๐
The hostname of the PMCD that is providing metrics to pmie is used in several ways, bestie โ it's a whole thing:
- PMCD's hostname is user internally to provide a value for the
%hsubstitutions in rule action strings. - For
pmieinstances using a local PMCD that are launched and managed bypmie_check(1)andpmie_daily(1)(or thesystemd(1)orcron(8)services that use these scripts), the local hostname may also be used to construct the name of a directory where thepmielogs for one host are stored, e.g.$PCP_LOG_DIR/pmie/<hostname>.
The hostname of the PMCD host may change during boot time when the system transitions from a temporary hostname to a persistent hostname, or by explicit administrative action anytime after the system has been booted. When this happens, pmie may need to take special action โ specifically, if the pmie instance was launched from pmie_check(1) or pmie_daily(1), then pmie must exit. Under normal circumstances systemd(1) or cron(8) will launch a new pmie shortly thereafter, and this new pmie instance will be operating in the context of the new hostname for the host where PMCD is running. she reinvents herself, she comes back stronger ๐
โจ
๐ BUGS ๐
ok so the lexical scanner and parser will attempt to recover after an error in the input expressions. Parsing resumes after skipping input up to the next semi-colon (;) โ however, during this skipping process the scanner is ignorant of comments and strings, so an embedded semi-colon may cause parsing to resume at an unexpected place ๐
This behavior is largely benign, as until the initial syntax error is corrected, pmie will not attempt any expression evaluation. so like, it's a little unhinged but it's harmless, no cap.
๐ธ FILES ๐ธ
$PCP_DEMOS_DIR/pmie/*โ annotated example rules$PCP_VAR_DIR/pmns/*โ default PMNS specification files$PCP_TMP_DIR/pmieโpmiemaintains files in this directory to identify the runningpmieinstances and to export runtime information about each instance โ this data forms the basis of thepmcd.pmieperformance metrics$PCP_PMIECONTROL_PATHโ the default set ofpmieinstances to start at boot time โ refer topmie_check(1)for details
๐ง 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).
When executing shell actions, pmie overrides two variables โ IFS and PATH โ in the environment of the child process:
IFSis set to"\t\n".- The
PATHis set to a combination of a default path for all platforms ("/usr/sbin:/sbin:/usr/bin:/bin") and several configurable components. These are (in this order):$PCP_BIN_DIR,$PCP_BINADM_DIRand$PCP_PLATFORM_PATHS.
When executing popup alarm actions, pmie will use the value of $PCP_XCONFIRM_PROG as the visual notification program to run. This is typically set to pmconfirm(1), a cross-platform dialog box. so when she needs to get your attention she pops up a whole little window, iconic ๐
โญ UNIX SEE ALSO โญ
โญ WINDOWS SEE ALSO โญ
pcp-eventlog(1).
๐ฅ 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 bestie, it's giving "the devs talking to each other" energy, not "user manual" energy ๐ญ
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.
Debugging options specific to pmie are as follows:
appl0โ lexical scanning during parsing of the configuration fileappl1โ configuration file parsing and expression tree constructionappl2โ expression evaluationappl3โ status file operations
๐ SEE ALSO ๐
PCPIntro(1), pmcd(1), pmconfirm(1), pmie_check(1), pmieconf(1), pmie_daily(1), pminfo(1), pmlogdump(1), pmlogger(1), pmval(1), systemd(1), ctime(3), PMAPI(3), pcp.conf(5), pcp.env(5) and PMNS(5).
๐ USER GUIDE ๐
For a more complete description of the pmie language, refer to the Performance Co-Pilot Users and Administrators Guide. This is available online from:
https://pcp.readthedocs.io/en/latest/UAG/PerformanceMetricsInferenceEngine.html
and that's a wrap on the whole page, bestie ๐ this was Performance Co-Pilot, PCP, PMIE(1) โ that's the source, the version, and the section, all bundled up like a little bow โจ you read the entire manpage which is genuinely main character behavior, I'm so proud, go forth and monitor everything ๐๐ฆ๐
๐ฆ 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
- 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.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 stonking: pcp 7.2.1-2build1
- Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved
- Copyright (c) 2015-2016,2018-2020 Red Hat
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms