Required version: 1.1.7i4
August 05. 2010
Check Parameters for Inventorized Checks
During inventory Check_MK creates checks (Nagios
services) for items that should be checked. These checks are
written to text files in /var/lib/check_mk/autochecks/*.mk.
The question that soon arises is: how can I configure parameters
for those checks? How can e.g. warning and critical levels for filesystems checks?
There are several ways to do that:
- Creating manual checks instead of inventorized checks (using the variable checks).
- Using the config variable check_parameters (available since 1.1.7i4).
- Setting check specific global default values.
- Deprecated since 1.1.7i4: using check specific special configuration such as filesystem_levels.
Precedence of parameter definitions
The general way how check parameters are applied is:
- If the check is defined manually via checks, parameters given there are used,
regardless of any other settings.
- If the check has been created by inventory, then the rules in check_parameters are
applied (see below).
- If no rule in check_parameters applies, then a check specific configuration
variable for system wide default levels is consulted, if you have defined that
in main.mk. For example for filesystem checks such a levels can be defined with:
main.mk
filesystem_default_levels = (90, 95)
- As a last resort each check has hard coded global default parameters.
For example all filesystem
checks (e.g. df or df_netapp) have global
default levels of (80, 90). Information about that
can be found in the checks man pages.
Rule based check parameters
With the configuration variable check_parameters you can define rules
for check parameters, using host names, host tags and service descriptions.
The syntax is the same as in many other cases in Check_MK,
for example as in service_groups.
Here is an example for defining filesystem levels:
main.mk
check_parameters = [
# (1) Filesystem C: on winsrv02 gets levels (92, 96)
( (92, 96), [ "winsrv02" ], [ "fs_C:" ]),
# (2) Filesystems on hosts with tag 'sap' and 'test' are always OK
( (101, 101), [ 'sap', 'test' ], ALL_HOSTS, [ "fs_"]),
# (3) Levels for filesystems below /sap (also /saptrans, /saptest)
( (80, 95), ALL_HOSTS, [ "fs_/sap" ]),
# (4) Levels for filesystems /var and /tmp on all hosts
( (90, 95), ALL_HOSTS, [ "fs_/var$", "fs_/tmp$" ] ),
# (5) Set levels for all remaining file systems to 80% / 90%
( (80, 90), ALL_HOSTS, [ "fs_" ] ),
]
Please note, that:
- The service expressions are always matched against the beginning of
the service name. They are regular expressions. Use a $ to denote
the end.
- If a service description matches more than one rule, the first match
wins. So the most specific rules (the exceptions) must be appear first.
- Make sure that the parameters are in the format expected by the specific
check. Please refer to the check manual of the check in question (check_mk -M).
- These rules only apply on checks found by inventory. For example the rule (3)
applies only to hosts which actually have a filesystem beginning with /sap.