Concepts
Several types of log and state files are being kept by the HC tool:
-
check_health.sh.log
: log file of the main script itself. Provides a chronological detail of all script runs
-
hc.log
: log file containing a formatted records of HC executions and results. Standard format is as follows:
For example:
A HC result (or STC) of:
- <>0: indicates that the corresponding HC has failed (~problems)
- 0: indicates that the corresponding HC did not detect any issues.
- Event files: upon HC failure, a FAIL_ID will be generated (=timestamp). Such FAIL_ID is used to generate an event and corresponding evidence of the event. Typically this will lead to STDOUT/STDERR information gathered during the HC being saved into a separate event directory. For example:
In this example the FAIL_ID is 20160417030000 and can be used to retrace the event also in the hc.log:
Events are organized in separate directories per month-year (e.g. 2016-04) to avoid cluttering of a single directory.
-
State files: some plugins may require the use of a state or intermediary file(s) to retain info between checks. Such files are placed in the location pointed to by the
STATE_DIR
setting. This location is also used for the enablement/disablement feature of HC plugins themselves. Never clean such files unless you know what you are doing
Logging control
--no-log
Logging can be ad-hoc switched off by using the --no-log
script option. This will run the health checker in a preview or dry-run mode. The actual health check(s) will be executed but no results will be logged
log_healthy
This option can be enabled via 2 ways:
- command-line option
--log-healthy
- plugin configuration parameter
log_healthy
(note that not all plugins support this option, see--list
)
The --log-health
y option will control the logging (and display) of passed health checks (aka healthy health checks). Most of the plugins will only log/show failed health checks (but this is dependent on the plugin code also).
You can combine the --log_healthy
option with the --no-log
command-line option to toggle messages being displayed but not being logged. --no-log
always takes highest precedence.
Your HC log file may grow very quickly though when passed health checks are also logged.
Leave a comment