Inventory ChecksJuly 11. 2009
Automatic Inventory ChecksFrom version 1.0.34 on check_mk supports automatic inventory checks. This allows you to configure regular checks that try (but do not perform) an inventory. If inventory would find new services then you will be warned (the check will get yellow or red). ConfigurationActivating inventory checks is quite easy. All you have to to is to set one variable in main.mk: main.mk inventory_check_interval = 120 The value defines how often the check should be performed. It is measured in Nagios intervals - usually one minute. So the upper example does one inventory check per host every two hours - which should be sufficient. After check_mk -U and restarting Nagios you will see one new check called "Check_MK inventory" at each host. If check_mk finds new unchecked services on the host, the inventory check will become CRITICAL. You can change the state WARNING by setting inventory_check_severity to 1 in main.mk: main.mk inventory_check_severity = 1 Note: from version 1.1.9i1 on the default setting for the severity is 1 (WARNING). TemplatesIf you are updating from 1.0.33 or a previous version, please also make sure, that you use the newest version of check_mk_templates.cfg. This contains one new template check_mk_inventory and the according check command check-mk-inventory. The default definitions of both are: check_mk_templates.cfg
define service {
name check_mk_inventory
use check_mk_default
register 0
check_command check-mk-inventory
active_checks_enabled 1
}
define command {
command_name check-mk-inventory
command_line /usr/bin/check_mk --cache --check-inventory $HOSTNAME$
}
SNMP Hosts and Ping-only-hostsThe inventory check also works for SNMP hosts. In this case the inventory is performed for those checktypes that are already present on the host. Note: Hosts that are not listed in snmp_hosts will be checked with both TCP and SNMP. For hosts having neither a TCP nor a SNMP based check ("ping-only-hosts") no inventory check will be created. How inventory checks workYou can manually test inventory checks by calling check_mk with the option --check-inventory and the name of a host. Check_mk behaves like a Nagios plugin in that case: root@linux# check_mk --check-inventory localhost CRITICAL - 4 unchecked services (df:1, diskstat:2, mem.used:1) root@linux# echo $? 2 Please note, that the inventory check fetches data from the agent unless you use the option --cache, which uses the cache file, if present. Normally fetching data from the agent should be no problem. When you use logfile monitoring, however, that could lead to missing log messages. The agent sends new log messages only once. And the inventory check ignores those messages and does not store them. For that reason, the default templates shipped with check_mk use the --cache option. If inventory checks are enabled in main.mk by setting inventory_check_interval then check_mk automatically creates check definitions together with the other service checks. They look like that: check_mk_objects.cfg
define service {
use check_mk_inventory
host_name localhost
normal_check_interval 1
service_description Check_MK inventory
}
define servicedependency {
use check_mk
host_name localhost
service_description Check_MK
dependent_host_name localhost
dependent_service_description Check_MK inventory
}
As you can see, also a service dependency definition has been created. If the check_mk agent is not reachable then the inventory will also fail. Contact groups of inventory checksThe Nagios attributes of inventory checks cannot be configured via check_mk. Please configure them in the default template check_mk_inventory in check_mk_templates.cfg. Note: the service does not have a contact or contact group by default. That way it inherits the contacts from the host object. And they can by configured for each host individually in main.mk by making use of host_contactgroups. The variable service_contactgroups has no effect on the inventory checks. ClustersInventory checks also work when using clusters. Since inventory is never done on the clusters but instead on the underlying cluster nodes also the inventory checks are only created for the nodes. |
| |||||||||||||||||||||