The New Check API

Dies ist die alte Dokumentation.
Sie können die neue Dokumentation hier finden, die im Laufe der Zeit die Artikel hier nach und nach ersetzt.
Dieser Artikel wird nicht mehr gepflegt und ist unter Umständen nicht mehr gültig - der neue Artikel hierzu ist jedoch noch nicht fertig!

1. The New Check API

As you have learned in previous articles, a check must be declared to Checkmk. In the old times this had be done with a line like this:

check_info["uptime"] = (check_uptime, "Uptime", 1, inventory_uptime)

As of version 1.2.0 Checkmk offers an alternative dictionary based declaration:

check_info["uptime"] = {
    "inventory_function"  : inventory_uptime,
    "check_function"      : check_uptime,
    "has_perfdata"        : True,
    "service_description" : "Uptime",

This new style has the advantage that it also covers further keys that had been kept in special variables, which now become obsolete. Here is a more complex example (from the df check):

check_info['df'] = {
    "check_function"          : check_df,
    "inventory_function"      : inventory_df,
    "service_description"     : "fs_%s",
    "has_perfdata"            : True,
    "group"                   : "filesystem",
    "default_levels_variable" : "filesystem_default_levels",
    "includes"                : [ "df.include" ],

2. Available Parameters for check_info[mycheck]

The following table lists all possible keys in the new dictionary-type declaration. The only mandatory parameters are check_function and service_description:

check_functionThe check function (like first parameter in old-style declaration)
inventory_functionThe inventory function (forth parameter in old-style declaration)
service_descriptionThe service description for Nagios (second parameter)
has_perfdataTrue if the check sends performance data, False or missing if otherwise (replaces the 0 and 0 of the old-style third paramter).
groupWATO configuration group for this check (formerly checkgroup_of[...])
default_levels_variableName (not value!) of the variable that the user can define in in order to define default levels. This works only for dictionary based parameters (formerly check_default_levels[...]).
includesA list of files this check needs to include (formerly check_includes[...])
snmp_infoSNMP OID configuration for SNMP checks (formerly snmp_info[...])
snmp_scan_functionSNMP scan function for SNMP checks (formerly snmp_scan_functions[...])
parse_functionA function who should parse all information before passing it to the check or inventory function