1PMLOGGER_CHECK(1) General Commands Manual PMLOGGER_CHECK(1)
2
3
4
6 pmlogger_check, pmlogger_daily - administration of Performance Co-Pilot
7 archive log files
8
10 $PCP_BINADM_DIR/pmlogger_check [-CNsTV?] [-c control] [-l logfile]
11 $PCP_BINADM_DIR/pmlogger_daily [-KMNoprRV?] [-c control] [-k discard]
12 [-l logfile] [-m addresses] [-s size] [-t want] [-x compress] [-X pro‐
13 gram] [-Y regex]
14
16 These shell scripts and associated control files may be used to create
17 a customized regime of administration and management for Performance
18 Co-Pilot (see PCPIntro(1)) archive log files.
19
20 pmlogger_check may be run at any time of the day and is intended to
21 check that a desired set of pmlogger(1) processes are running. If not,
22 it (re-)starts any missing logger processes.
23
24 pmlogger_daily is intended to be run once per day, preferably in the
25 early morning, as soon after midnight as practicable. Its task is to
26 aggregate, rotate and perform general housekeeping one or more sets of
27 PCP archives.
28
29 To accommodate the evolution of PMDAs and changes in production logging
30 environments, pmlogger_daily is integrated with pmlogrewrite(1) to
31 allow optional and automatic rewriting of archives before merging. If
32 there are global rewriting rules to be applied across all archives men‐
33 tioned in the control file(s), then create the directory
34 $PCP_SYSCONF_DIR/pmlogrewrite and place any pmlogrewrite(1) rewriting
35 rules in this directory. For rewriting rules that are specific to only
36 one family of archives, use the directory name from the control file(s)
37 - i.e. the fourth field - and create a file, or a directory, or a sym‐
38 bolic link named pmlogrewrite within this directory and place the
39 required rewriting rule(s) in the pmlogrewrite file or in files within
40 the pmlogrewrite subdirectory. pmlogger_daily will choose rewriting
41 rules from the archive directory if they exist, else rewriting rules
42 from $PCP_SYSCONF_DIR/pmlogrewrite if that directory exists, else no
43 rewriting is attempted.
44
45 As an alternate mechanism, if the file $PCP_LOG_DIR/pmlogger/.Nee‐
46 dRewrite exists when pmlogger_daily starts then this is treated the
47 same as specifying -R on the command line and $PCP_LOG_DIR/pmlog‐
48 ger/.NeedRewrite will be removed once all the rewriting has been done.
49
51 -c control, --control=control
52 Both pmlogger_check and pmlogger_daily are controlled by PCP log‐
53 ger control file(s) that specifies the pmlogger instances to be
54 managed. The default control file is $PCP_PMLOGGERCONTROL_PATH,
55 but an alternate may be specified using the -c option. If the
56 directory $PCP_PMLOGGERCONTROL_PATH.d (or control.d from the -c
57 option) exists, then the contents of any additional control files
58 therein will be appended to the main control file (which must
59 exist).
60
61 -C This option causes pmlogger_check to query the system service run‐
62 level information for pmlogger, and use that to determine whether
63 to start processes or not.
64
65 -k period, --discard=period
66 After some period, old PCP archives are discarded. This period is
67 14 days by default, but may be changed using this option. Some
68 special values are recognized for the period, namely 0 to keep no
69 archives beyond the current one, and forever or never to prevent
70 any archives being discarded. Note that the semantics of discard
71 are that it is measured from the time of last modification of each
72 archive, and not from the current day. This has subtle implica‐
73 tions for compression (see below) - the compression process
74 results in the creation of new archive files which have new modi‐
75 fication times. In this case, the discard period (re)starts from
76 the time of compression.
77
78 -K When this option is specified for pmlogger_daily then only the
79 compression tasks are attempted, so no pmlogger rotation, no
80 culling, no rewriting, etc. When -K is used and a compress value
81 of 0 is in effect (from -x on the command line or PCP_COMPRES‐
82 SAFTER in the environment or via the control file) this is
83 intended for environments where compression of archives is desired
84 before the scheduled daily processing happens. To achieve this,
85 once pmlogger_check has completed regular processing, it calls
86 pmlogger_daily with just the -K option. Provided PCP_COMPRES‐
87 SAFTER is set to 0 along with any other required compression
88 options to match the scheduled invocation of pmlogger_daily, then
89 this will compress all volumes except the ones being currently
90 written by pmlogger(1).
91
92 -l file, --logfile=file
93 In order to ensure that mail is not unintentionally sent when
94 these scripts are run from cron(8) diagnostics are always sent to
95 log files. By default, this file is $PCP_LOG_DIR/pmlogger/pmlog‐
96 ger_check.log or $PCP_LOG_DIR/pmlogger/pmlogger_daily.log but this
97 can be changed using the -l option. If this log file already
98 exists when the script starts, it will be renamed with a .prev
99 suffix (overwriting any log file saved earlier) before diagnostics
100 are generated to the log file. The -l and -t options cannot be
101 used together.
102
103 -m addresses, --mail=addresses
104 Use of this option causes pmlogger_daily to construct a summary of
105 the ``notices'' file entries which were generated in the last 24
106 hours, and e-mail that summary to the set of space-separated
107 addresses. This daily summary is stored in the file
108 $PCP_LOG_DIR/NOTICES.daily, which will be empty when no new
109 ``notices'' entries were made in the previous 24 hour period.
110
111 -M This option may be used to disable archive merging (or renaming)
112 and rewriting (-M implies -r). This is most useful in cases where
113 the archives are being incrementally copied to a remote reposi‐
114 tory, e.g. using rsync(1). Merging, renaming and rewriting all
115 risk an increase in the synchronization load, especially immedi‐
116 ately after pmlogger_daily has run, so -M may be useful in these
117 cases.
118
119 -N, --showme
120 This option enables a ``show me'' mode, where the programs actions
121 are echoed, but not executed, in the style of ``make -n''. Using
122 -N in conjunction with -V maximizes the diagnostic capabilities
123 for debugging.
124
125 -o By default all possible archives will be merged. This option
126 reinstates the old behaviour in which only yesterday's archives
127 will be considered as merge candidates. In the special case where
128 only a single input archive needs to be merged, pmlogmv(1) is used
129 to rename the archive, otherwise pmlogger_merge(1) is used to
130 merge all of the archives for a single host and a single day into
131 a new PCP archive and the individual archives are removed.
132
133 -p If this option is specified for pmlogger_daily then the status of
134 the daily processing is polled and if the daily pmlogger(1) rota‐
135 tion, culling, rewriting, compressing, etc. has not been done in
136 the last 24 hours then it is done now. The intent is to have
137 pmlogger_daily called regularly with the -p option (at 30 mins
138 past the hour, every hour in the default cron(8) set up) to ensure
139 daily processing happens as soon as possible if it was missed at
140 the regularly scheduled time (which is 00:10 by default), e.g. if
141 the system was down or suspended at that time. With this option
142 pmlogger_daily simply exits if the previous day's processing has
143 already been done. The -K and -p options to pmlogger_daily are
144 mutually exclusive.
145
146 -r, --norewrite
147 This command line option acts as an override and prevents all ar‐
148 chive rewriting with pmlogrewrite(1) independent of the presence
149 of any rewriting rule files or directories.
150
151 -R, --rewriteall
152 Sometimes PMDA changes require all archives to be rewritten, not
153 just the ones involved in any current merging. This is required
154 for example after a PCP upgrade where a new version of an existing
155 PMDA has revised metadata. The -R command line forces this uni‐
156 versal-style of rewriting. The -R option to pmlogger_daily is
157 mutually exclusive with both the -r and -M options.
158
159 -s size, --rotate=size
160 If the PCP ``notices'' file ($PCP_LOG_DIR/NOTICES) is larger than
161 20480 bytes, pmlogger_daily will rename the file with a ``.old''
162 suffix, and start a new ``notices'' file. The rotate threshold
163 may be changed from 20480 to size bytes using the -s option.
164
165 -s, --stop
166 Use of this option provides the reverse pmlogger_check functional‐
167 ity, allowing the set of pmlogger processes to be cleanly shut‐
168 down.
169
170 -t period
171 To assist with debugging or diagnosing intermittent failures the
172 -t option may be used. This will turn on very verbose tracing
173 (-VV) and capture the trace output in a file named
174 $PCP_LOG_DIR/pmlogger/daily.datestamp.trace, where datestamp is
175 the time pmlogger_daily was run in the format YYYYMMDD.HH.MM. In
176 addition, the period argument will ensure that trace files created
177 with -t will be kept for period days and then discarded.
178
179 -T, --terse
180 This option to pmlogger_check produces less verbose output than
181 the default. This is most suitable for a pmlogger ``farm'' where
182 many instances of pmlogger are expected to be running.
183
184 -V, --verbose
185 The output from the cron execution of the scripts may be extended
186 using the -V option to the scripts which will enable verbose trac‐
187 ing of their activity. By default the scripts generate no output
188 unless some error or warning condition is encountered. Using -N
189 in conjunction with -V maximizes the diagnostic capabilities for
190 debugging.
191
192 -x period, --compress-after=period
193 Archive data files can optionally be compressed after some period
194 to conserve disk space. This is particularly useful for large
195 numbers of pmlogger processes under the control of pmlogger_check.
196 If transparent_decompress is enabled when libpcp was built (can be
197 checked with the pmconfig(1) -Loption), then the default behaviour
198 is compression ``as soon as possible''. Otherwise the default be‐
199 haviour is to not compress files (which matches the historical
200 default behaviour in earlier PCP releases). The -x option speci‐
201 fies the number of days after which to compress archive data and
202 metadata files. If compress is 0 then compression will be applied
203 as soon as possible. If compress is never or forever then no com‐
204 pression will be done. The environment variable PCP_COMPRESSAFTER
205 may be used as an alternative mechanism to define compress. If
206 both PCP_COMPRESSAFTER and -x specify different values for com‐
207 press then the environment variable value is used and a warning is
208 issued.
209
210 -X program, --compressor=program
211 This option specifies the program to use for compression - by
212 default this is xz(1). The environment variable PCP_COMPRESS may
213 be used as an alternative mechanism to define program. If both
214 PCP_COMPRESS and -X specify different compression programs then
215 the environment variable value is used and a warning is issued.
216
217 -Y regex, --regex=regex
218 This option allows a regular expression to be specified causing
219 files in the set of files matched for compression to be omitted -
220 this allows only the data file to be compressed, and also prevents
221 the program from attempting to compress it more than once. The
222 default regex is ".(index|Z|gz|bz2|zip|xz|lzma|lzo|lz4)$" - such
223 files are filtered using the -v option to egrep(1). The environ‐
224 ment variable PCP_COMPRESSREGEX may be used as an alternative
225 mechanism to define regex. If both PCP_COMPRESSREGEX and -Y spec‐
226 ify different values for regex then the environment variable value
227 is used and a warning is issued.
228
229 -?, --help
230 Display usage message and exit.
231
233 Warning: The $PCP_PMLOGGERCONTROL_PATH and $PCP_PMLOGGERCONTROL_PATH.d
234 files must not be writable by any user other than root.
235
236 The control file(s) should be customized according to the following
237 rules that define for the current version (1.1) of the control file
238 format.
239
240 1. Lines beginning with a ``#'' are comments.
241 2. Lines beginning with a ``$'' are assumed to be assignments to envi‐
242 ronment variables in the style of sh(1), and all text following the
243 ``$'' will be eval'ed by the script reading the control file, and
244 the corresponding variable exported into the environment. This is
245 particularly useful to set and export variables into the environ‐
246 ment of the administrative scripts, e.g.
247 $ PMCD_CONNECT_TIMEOUT=20
248 3. There must be a version line in the initial control file of the
249 form:
250 $ version=1.1
251 4. There should be one line in the control file(s) for each pmlogger
252 instance of the form:
253
254 host y|n y|n directory args
255
256 5. Fields within a line of the control file(s) are usually separated
257 by one or more spaces or tabs (although refer to the description of
258 the directory field for some important exceptions).
259 6. The first field is the name of the host that is the source of the
260 performance metrics for this pmlogger instance.
261 7. The second field indicates if this is a primary pmlogger instance
262 (y) or not (n). Since the primary logger must run on the local
263 host, and there may be at most one primary logger for a particular
264 host, this field can be y for at most one pmlogger instance, in
265 which case the host name must be the name of the local host.
266 8. The third field indicates if this pmlogger instance needs to be
267 started under the control of pmsocks(1) to connect to a pmcd
268 through a firewall (y or n).
269 9. The fourth field is a directory name. All files associated with
270 this pmlogger instance will be created in this directory, and this
271 will be the current directory for the execution of any programs
272 required in the maintenance of those archives. A useful convention
273 is that primary logger archives for the local host with hostname
274 myhost are maintained in the directory $PCP_ARCHIVE_DIR/myhost
275 (this is where the default pmlogger start-up script in
276 $PCP_RC_DIR/pcp will create the archives), while archives for the
277 remote host mumble are maintained in $PCP_ARCHIVE_DIR/mumble.
278 10. The directory field may contain embedded shell syntax that will be
279 evaluated by sh(1) to produce the real directory name to be used.
280 The allowed constructs are:
281 · Any text (including white space) enclosed with $( and ).
282 · Any text (including white space) enclosed with ` and ` (back
283 quotes).
284 · Any text (including white space) enclosed with " and " (double
285 quotes).
286 · Any word containing a $ (assumed to introduce an environment
287 variable name).
288 11. All other fields are interpreted as arguments to be passed to
289 pmlogger(1). Most typically this would be the -c option.
290
291 The following sample control lines specify a primary logger on the
292 local host (bozo), and non-primary loggers to collect and log perfor‐
293 mance metrics from the hosts wobbly and boing.
294
295 $version=1.1
296 bozo y n $PCP_ARCHIVE_DIR/bozo -c config.default
297 wobbly n n "/store/wobbly/$(date +%Y)" -c ./wobbly.config
298 boing n n $PCP_ARCHIVE_DIR/boing -c ./pmlogger.config
299
300 Typical crontab(5) entries for periodic execution of pmlogger_daily and
301 pmlogger_check are given in $PCP_SYSCONF_DIR/pmlogger/crontab (unless
302 installed by default in /etc/cron.d already) and shown below.
303
304 # daily processing of archive logs
305 14 0 * * * $PCP_BINADM_DIR/pmlogger_daily
306 # every 30 minutes, check pmlogger instances are running
307 25,55 * * * * $PCP_BINADM_DIR/pmlogger_check
308
309 When using systemd(1) on Linux, no crontab entries are needed as the
310 timer mechanism provided by systemd is used instead.
311
313 $PCP_PMLOGGERCONTROL_PATH
314 the PCP logger control file
315 Warning: this file must not be writable by any user other than
316 root.
317
318 $PCP_PMLOGGERCONTROL_PATH.d
319 optional directory containing additional PCP logger control files,
320 typically one per host
321 Warning: the files herein must not be writable by any user other
322 than root.
323
324 $PCP_SYSCONF_DIR/pmlogger/crontab
325 sample crontab for automated script execution by $PCP_USER (or
326 root). Exists only if the platform does not support the
327 /etc/cron.d mechanism.
328
329 $PCP_VAR_DIR/config/pmlogger/config.default
330 default pmlogger configuration file location for the local primary
331 logger, typically generated automatically by pmlogconf(1).
332
333 $PCP_ARCHIVE_DIR/<hostname>
334 default location for archives of performance information collected
335 from the host hostname
336
337 $PCP_ARCHIVE_DIR/<hostname>/lock
338 transient lock file to guarantee mutual exclusion during pmlogger
339 administration for the host hostname - if present, can be safely
340 removed if neither pmlogger_daily nor pmlogger_check are running
341
342 $PCP_ARCHIVE_DIR/<hostname>/Latest
343 PCP archive folio created by mkaf(1) for the most recently
344 launched archive containing performance metrics from the host
345 hostname
346
347 $PCP_LOG_DIR/NOTICES
348 PCP ``notices'' file used by pmie(1) and friends
349
350 $PCP_LOG_DIR/pmlogger/pmlogger_check.log
351 if the previous execution of pmlogger_check produced any output it
352 is saved here. The normal case is no output in which case the
353 file does not exist.
354
355 $PCP_LOG_DIR/pmlogger/pmlogger_daily.log
356 if the previous execution of pmlogger_daily produced any output it
357 is saved here. The normal case is no output in which case the
358 file does not exist.
359
360 $PCP_ARCHIVE_DIR/<hostname>/SaveLogs
361 if this directory exists, then the log file from the -l argument
362 of a newly launched pmlogger(1) for hostname will be linked into
363 this directory with the name archive.log where archive is the
364 basename of the associated pmlogger(1) PCP archive files. This
365 allows the log file to be inspected at a later time, even if sev‐
366 eral pmlogger(1) instances for hostname have been launched in the
367 interim. Because the cron-driven PCP archive management scripts
368 run under the uid of the user ``pcp'', $PCP_ARCHIVE_DIR/host‐
369 name/SaveLogs typically needs to be owned by the user ``pcp''.
370
371 $PCP_LOG_DIR/pmlogger/.NeedRewrite
372 if this file exists, then this is treated as equivalent to using
373 -R on the command line and the file will be removed once all
374 rewriting has been done.
375
377 Environment variables with the prefix PCP_ are used to parameterize the
378 file and directory names used by PCP. On each installation, the file
379 /etc/pcp.conf contains the local values for these variables. The
380 $PCP_CONF variable may be used to specify an alternative configuration
381 file, as described in pcp.conf(5).
382
383 The default behaviour, when pmlogger(1) configuration comes from pmlog‐
384 conf(1), is to regenerate the configuration file and check for changes
385 whenever pmlogger(1) is started from pmlogger_check. If the PMDA con‐
386 figuration is stable, this is not necessary, and setting $PMLOG‐
387 GER_CHECK_SKIP_LOGCONF to yes disables the regeneration and checking.
388
390 egrep(1), PCPIntro(1), pmconfig(1), pmlc(1), pmlogconf(1), pmlogger(1),
391 pmlogger_daily_report(1), pmlogger_merge(1), pmlogmv(1), pmlo‐
392 grewrite(1), pmsocks(1), systemd(1), xz(1) and cron(8).
393
394
395
396Performance Co-Pilot PCP PMLOGGER_CHECK(1)