Configuration variablesSeptember 11. 2009
This article gives an overview over all general configuration variables that can be put into main.mk. Many check types define further variables which are not explained here. Please refer to the check manuals for information about check specific configuration variables. Basic settingsThe basic settings influence global aspects. The most important and only obligatory variable is all_hosts. For each variable you'll find the default value after the equal sign. For more examples please look into the annotated example file main.mk.example which will be installed into your documentation directory when you setup check_mk. check_parametersThis is a configuration list assigning specific check parameters to checks created by inventory. It is a list of rules. Each rule is a tuple of
Example: 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_" ] ), ] checksList of manually configured checks (those not found be inventory). Each entry of the list is four or five-tuple with the following elements:
Example: checks = [ ( "cluster1", "df", "/", ( 80, 90 ) ), ( ["lnx"], ALL_HOSTS, "ps", "NTPD", ( "/usr/sbin/ntpd",1,1,1,1)), ] Default: checks = [] agent_portTCP port the check_mk_agent is expected to listen on. Default: agent_port = 6556 agent_portsNew in 1.1.11i2: this variable allows to specify the TCP port to be used to connect to the agent on a per-host-basis. The syntax is the same as with datasource_programs. Here is an example assigning the port 6600 to all hosts with the tag dmz: agent_ports += [ ( 6600, [ "dmz" ], ALL_HOSTS ), ] If no entry matches, then the setting of agent_port is used. tcp_connect_timeoutNumber of seconds after which an agent is considered to be unreachable. Note that the timeout is just applied to the creation of the connection. Once the connection is build up, no timeout can occur. Default: tcp_connect_timeout = 5.0 do_rrd_updateDeprecated Whether or not to do direct RRD updates. Python support for rrdtool must be available if set to True. Check_mk enters values directly into RRD databases if there are alread available under rrd_path. You still need PNP4Nagios to create those databases. Default: do_rrd_update = False This option has been removed in version 1.1.13i1. delay_precompileNew in 1.1.11i2: If you set delay_precompile to True, then Check_MK will not directly Python-bytecompile all host checks when doing -C, -U, -O or -R, but will delay this to the first time the host is actually checked being by Nagios. This reduces the time needed for the operation, but on the other hand will lead to a slightly higher load of Nagios for the first couple of minutes after the restart. Note: In order for this option to work, Nagios needs write access in the directory precompiled, where the precompiled host checks are stored. This is always the case when using OMD. The default value is False. Example: delay_precompile = True perfdata_formatWhen using MRPE, Nagios looses the information about the name of the original check command. As of version 1.1.4 the Linux agent (and maybe later others as well) send the name of the check command and the check mrpe will process this. In order to make that information usable by PNP4Nagios you need to set perfdata_format to "pnp". Other graphing tools are currently not supported. perfdata_format = "pnp" The default value is "standard", which strictly adhers to the Nagios standards for performance data format and does include any information about the check command. check_max_cachefile_ageThe number of seconds a cache file may be old if check_mk should use it instead of getting information from the target host. Per default this is disabled by setting the value to 0. Default: check_max_cachefile_age = 0 datasource_programsThis is a configuration list that allows you to define external commands as data sources when retrieving data from a host - instead of a TCP connection to the agent. Please refer to this article for details. www_groupWhen the logwatch check stores log messages for review and acknowledgement by the logwatch web page it has to make sure, that the web server can delete those files. This is done by giving the directories holding the files to a group where both Nagios and the web server have to be in. If that group is not successfully autodetected during setup, you have to specify it manually in main.mk. Example: www_group = "www-data" simulation_modeThis boolean variable allows you to bring check_mk into a dry run mode. No hosts will be contacted, no DNS lookups will take place and data is read from cache files. Example: simulation_mode = True debug_logIf you set this to a filename, Check_MK will create a debug logfile containing details about failed checks (those which have state UNKNOWN and the output UNKNOWN - invalid output from plugin.... Per default no logfile is written. Example: debug_log = "/var/log/nagios/check_mk_debug.log" If you're using OMD, set it to a directory writeable for your OMD site user. Example: debug_log = "/omd/sites/mysitename/var/log/check_mk_debug.log" monitoring_hostNew in 1.1.7i2. Set this variable to the name of your monitoring (Nagios, etc.) host as listed in all_hosts. The default value is localhost, but this is not correct for all installations. This setting is currently only needed when scanning for parents using --scan-parents, but might be used for future features as well. Example: monitoring_host = "zsrvnag01" scanparent_hostsNew in 1.1.7i2. When using --scan-parents you can use this variable to reduce the number of hosts for which parents are autodetected. This is a binary host list similar to bulkwalk_hosts. It is preset to [( ALL_HOSTS, )], so that --scan-parents affects all hosts. The following example restricts it to non-snmp hosts: scanparent_hosts = [ ( ["!snmp"], ALL_HOSTS ), ] max_num_processesMaximum number of parallel processes to start when doing a parent scan. The default is 50. Example: allow up to 200 processes: max_num_processes = 200 check_submissionNew in 1.1.11i1: Check_MK now supports creating Nagios check files instead of writing into the Nagios command pipe when submitting check results. Creating the files reduces overhead in the Nagios core. Furthermore Check_MK can submit results even when Nagios is currently not running. Upto version 1.1.12 this variable is preset to "pipe" which uses the command pipe for submission. From 1.1.13i1 on the default is "file". You can set it to "file" for creating check files instead: check_submission = "file" Settings for hostsall_hostsThe list of all hostnames that shall be monitored with check_mk. Hostnames are strings. Strings can generally be written either in single or in double quotes. It is legal to use an IP address instead of a hostname. Host tags may be added using a vertical bar. Example: all_hosts = [ "xyzabc1|muc", 'xyzabc2|ber', "xyzabc3|ber|test|some|other|tag", "xyzabc4", "10.0.34.35", ] Default: all_hosts = [] ipaddressesIf some of your hostname are not resolvable via DNS you need to specify the IP addresses manually. This is done with the this dictionary. Hostnames are the keys, IP addresses are the values. Entries in ipaddresses take precedence over DNS. Example:
ipaddresses = {
"xzyabc1" : "10.0.34.18",
"xyzcba2" : "192.168.0.17",
}
Default:
ipaddresses = {}
dyndns_hostsNew in 1.1.11i2. Hosts listed in this binary configuration list (which is compatible to bulkwalk_hosts), do never do a DNS lookup but use their host name in all places where otherwise the IP address would occur (also in the Nagios' host declarations). That way, a dynamic DNS lookup will be done whenever the host will be contacted. This is useful in two cases:
Example:
dyndns_hosts = [
# All hosts with the TAG "dyndns"
( [ "dyndns" ], ALL_HOSTS ),
# Three explicit hosts
( [ "hosta", "hostb", "hostc" ], ),
]
only_hostsThis is a binary host list simular to snmp_hosts. If you set this variable, then you limit check_mk to those hosts specified in the list. This is usefull for testing your installation with just some of your hosts. Example: only_hosts = [ # all hosts with tag "test" ( ["test"], ALL_HOSTS ), # and: two single special hosts (do not omit the comma # in the one-tuple! ( ["hostwin01", "hostwin02"], ) ] ping_levelsNew in version 1.1.13i1: This configuration list allows to specify parameters that are used for host checks (host checks are done with check_icmp in Check_MK). It is a configuration list with dictionary items with the following keys:
The following example set specific RTA levels for all hosts with the tag wan:
ping_levels += [
# Set RTA levels to 2/4 sec
( { "rta" : (2000, 4000) }, [ "wan" ], ALL_HOSTS ),
]
Generation of Nagios' configuration filesAll variables in this section influence the generation of the Nagios configuration files by check_mk. They are not relevant during normal operation of Nagios. Many of these support host tags. Per default - all configuration lists are empty ([]) host_groupsAdds hostgroup definitions to Nagios' hosts. Hosts can be in more than one group. The definition of the hostgroups themselves is not done by check_mk. You've to create them manually in your Nagios configuration. Example: host_groups = [ # Put all hosts with the tag 'muc' into the host group muc ( "muc", ["muc"], ALL_HOSTS ), # All non-cluster hosts go into the host group 'physical' ( "pyhiscal", PHYSICAL_HOSTS ), # The host-group 'test' just contains the hosts ab17 and ab18 ( "test", [ "ab17", "ab18" ] ), # All hosts (even ab17 and ab18) go into host group "all" ( "all", ALL_HOSTS ), ] host_contactgroupsDefines contact_group entries for hosts. This works exaclty like host_groups. The contact_group definitions must be created manually in the Nagios configuration. parentsDefines parent hosts of hosts. This works exacly like host_groups. Multiple parents may be specified in one comma separated string. Example: parents = [ # All hosts with the Tag "dmz" has sw01 and sw02 as parents ( "sw01,sw02", ["dmz"], ALL_HOSTS ), ] service_groupsThis variable adds Nagios service_group definitions to Services. The service groups themselves have to be created manually in the Nagios configuration. The difference to host_groups is, that each entry contains in addition a list of service descriptions, that specify which services should go into the group. This lists contains prefixes of services descriptions (as seen in the Nagios web interface). The strings are evaluated as extended regular expressions. An empty pattern "" matches all services. Example: service_groups = [ # All services beginning with "fs" on hosts with the tag "muc" # go into the service group "mucfs". ( "mucfs", ["muc"], ALL_HOSTS, [ "fs" ] ), # Put *all* services of sw01 and sw02 into the service # group "switches" ( "switches", ALL_HOSTS, ALL_SERVICES ), # Put services with the exact description "fs_/var" into # the group var (and exclude "fs_/var/log", etc.) ( "var", ALL_HOSTS, ["fs_/var$"] ), # Put various processes of hosts with the tag "linux" into # the group "os": ( "os", ["linux"], ALL_HOSTS, ["proc_NTPD", "proc_CRON", "proc_AT"] ), # Build a group of services containing the substring K15 ( "K15", ALL_HOSTS, [".*K15"]), ] service_contactgroupsAdd contact_group definitions to the Nagios services. This works exactly like service_groups. extra_host_confThis is a dictionary that allows you to define arbitrary Nagios variables in your host definitions. The keys into the dictionary are the Nagios directives to set. The values are a configuration lists similar to datasource_programs. The following example add a variable icon_image to some of the hosts (the file should be saved in images/icons/): extra_host_conf["icon_image"] = [ ( "linux.png", ["linux"], ALL_HOSTS ), ( "windows.png", ["windows"], ALL_HOSTS ), ( "special.png", [ "host123", "host345" ] ) ] extra_summary_host_confThis variable is identical to extra_host_conf, but is used for summary hosts. As usual - the real hostname are used for the lookup, not the summary host names. extra_service_confThis variable is a dictionary that allows you to define arbitrary Nagios variables in your service definitions. The keys into the dictionary are the Nagios directives to set. The values are configuration lists similar to extra_host_conf but needs a list of service patterns. The following example configures flap detection for all services on SNMP hosts the begin with NIC or Interface: extra_service_conf["flap_detection_enabled"] = [ ( "1", ["snmp"], ALL_HOSTS, ALL_SERVICES ), ( "1", ALL_HOSTS, ["NIC", "Interface"] ) ] service_descriptionsCheck_MK assigns its own scheme of services descriptions for all services it generates. Filesystem checks - as an example - always begin with fs_. This configuration variable allows to define custom name patterns for all check types. Check types with an item (such as df: the item is the mount point of the filesystem) must have exactly one %s in the description. That will be replaced with the item. Check types without an item (such as cpu.loads) must not have a %s. The following example assigns custom service descriptions to the check types df and cpu.loads:
service_descriptions = {
"df" : "Filesystem %s",
"cpu.loads" : "CPU Load average",
}
Please call check_mk -L for a list of all known check types and their default service description patterns. There you will also learn which check types await a %s and which not. service_dependenciesCreates Nagios service_dependency definitions between services of the same host. Please refer to examples in a dedicated article. define_hostgroupsThis variable controls, wether hostgroups that you assign with host_groups are automatically created in your Nagios configuration. Per default, no host groups will be created. If you set define_hostgroups to True, then all host groups referred to by host_groups will be created with the alias equal to the name. Alternatively you can make this variable a dictionary from host group names to their aliases. Please note, that only those host groups are created that are referred to by your configuration, even if more appear in the dictionary. Referred host groups not appearing in the dictionary will be created with their names as aliases. Example:
# Create all needed host groups
define_hostgroups = True
# Alternative: define aliases for some host groups
define_hostgroups = {
"linux" : "The Linux Servers",
"net" : "Active network components"
}
define_servicegroupsThis variable controls, wether service groups referred to by service_groups are automatically created in you Nagios configuration. Per default no groups are created. This variable works exaclty like define_hostgroups. Example:
define_servicegroups = {
"oracle" : "All ORACLE services",
"ports" : "The switch ports"
}
define_contactgroupsSetting this variable to True will make check_mk -U, -O and -R automatically create definitions for all contact groups referred to by any host or service handled by Check_MK. Just as with define_hostgroups and define_servicegroups you can alternatively set this variable to a dictionary and thus define aliasses. Example:
# Just define contactgroups without aliases
define_contactgroups = True
# Alternative: define aliases for (some) contactgroups
# (all other contactgroups will get their name as alias)
define_contactgroups = {
"unix" : "The UNIX admins",
"linux" : "Out Linux team",
}
Please note, that contact group definitions are not output, when using check_mk -H or check_mk -S. nagios_illegal_charsLists charactes that must not appear in Nagios' service_description definitions. Check_mk automatically removes those characters when creating the Nagios configuration. Please think twice if you remove characters from this list. Default: nagios_illegal_chars = '`~!$%^&*|\'"<>?,()=' Please note, that in this default settings the backslash is allowed. It is just needed in the Python string in order to quote the single quote. logwatch_notes_urlURL pointing to the logwatch web page logwatch.php. For each logfile monitoring service check_mk automatically adds a notes_urls entry. The entry must contain exaclty two times %s. The first occurrance is replaced with the host name, the second one with the service description (URL encoded). The default value is set by setup.sh. If the autodetection does not work properly, you can tune it manually. In such a case the default value is: logwatch_notes_url = "/nagios/logwatch.php?host=%s&file=%s" generate_hostconfSetting this variable to False supresses the generation of host definitions when creating configuration files for Nagios. This affects the options -U, -O and -R. Example: generate_hostconf = False generate_dummy_commandsSetting this variable to False supresses the generation of command definitions for the passive checks, when generating configuration files for Nagios. Those dummy commands are never execute but referred to by the service definitions. This allows you to select PNP4Nagios templates according to the check type. Setting this variable to False is neccessary in order to avoid duplicate definitions when merging outputs of multiple instances of check_mk together. Note: The check_command directives in the service definitions are always generated - regardless of the setting of generate_dummy_commands. Example: generate_dummy_commands = False Inventory and Inventory checksThe following variables control inventory. Further check specific parameters for inventory exist. Those are described in the man pages of those checks. ignored_checktypesList of check types that should be ignored when doing an inventory with check_mk -I alltcp or an inventory check with check_mk --check-inventory. They still can be inventorized explicitely, for example with check_mk -I df HOSTNAMES. Per default no check types are ignored. Example: ignored_checktypes = [ "netctr", "ipmi" ] ignored_servicesAn item-less configuration list (you can use host tags) that allows to exclude certain services on certain hosts from inventory. This has no effect on already existing services. Per default no services will be excluded from inventory. Please visit the article about inventory for details. Example: ignored_services = [ ( [ "win01", "win02" ], [ "LOG", "fs_C:" ] ), ( [ "linux" ], ALL_HOSTS, [ "fs_/tmp$" ] ) ] ignored_checksNEW in 1.1.9i1 List of check types that should be ignored for one or several hosts specified as explicit list of hostnames or as tags. This option is recognized during inventory only. The ignored checks still can be inventorized explicitely, for example with check_mk -I df HOSTNAMES. Per default no check types are ignored. Example: ignored_checks = [ ( "df", [ "win01", "win02" ]), ( [ "hr_cpu", "hr_mem", "hr_fs" ], [ "linux" ], ALL_HOSTS) ] inventory_max_cachefile_ageInventory is greatly sped up by using cache files. That makes use of the fact that check_mk saves agent information to a file for each host after each check. Per default, that file is being used if it is not older then 120 seconds. If you changed your normal_check_interval for the active check_mk checks to a value greater than one minute, you might have to adjust this to a larger value in order to prevent the inventory from fetching data from the agents directly. Example: # Use cache files for inventory even if up to 4 min old. inventory_max_cachefile_age = 240 # seconds always_cleanup_autochecksNEW in 1.1.7i1 If this variable is set to True then Check_MK always cleans up autochecks after each inventory. This does the same as adding the option -u to -I. inventory_check_intervalSetting this variable to a number of minutes enables inventory checks. Check_MK will then automatically create one active check per host that will make sure that no un-inventorized services exist for that host. Default is None, which switches off inventory checks. Example: # Do an inventory check every two hours inventory_check_interval = 120 # minutes inventory_check_severityIf an inventory check finds un-inventorized services on a host it usually results in a CRITICAL state. You can change this to WARNING or OK by settings this to 1 or 0 here. Example: # failing inventory checks should just warn inventory_check_severity = 1 Note: from version 1.1.9i1 on, the inventory_check_severity defaults to 1 (WARNING). SNMPThe following variables are relevant if you use check_mk for SNMP monitoring. snmp_default_communityDefault SNMP community when contacting hosts. Default: snmp_default_community = "public" snmp_communitiesIf some of your hosts need another SNMP community than your default, you can set them with this variable. It is a configuration list and allows host tags. It is compatible to datasource_programs. Example: main.mk snmp_communities = [ # all hosts with the tag "munich" have to community "muc-secret" ( "muc-secret", ["munich"], ALL_HOSTS ), # The two single hosts switch01, switch02 have "public00" ( "public00", ["switch01", "switch02"] ), # all other hosts have the snmp_default_community ] snmp_hostsThis is a item-less configuration list that specifies, which hosts should not be contacted via TCP when doing inventory. The default is to mark all hosts with the host tag snmp as SNMP hosts: snmp_hosts = [ (['snmp'], ALL_HOSTS) ] In rare cases you might want to define snmp_hosts yourself. Here is an example: snmp_hosts = [ # explicit list of hosts. Important: the comma after the list! ( ["switch01", "switch02"], ), # do not try TCP on these two # use host tags: all hosts with tag 'snmp', except those with tag 'both' ( ["snmp", "!both"], ALL_HOSTS ), # all other hosts will be contacted with TCP on inventory ] If you have hosts that are monitored via SNMP and TCP, then you must not declare them as SNMP hosts. bulkwalk_hostsThis item-less configuration list determines, which hosts support SNMP v2c and should use snmpbulkwalk instead of snmpwalk. Please refer to the manual page of that command for further details. Bulk walk is faster then the normal snmpwalk, since it is able to fetch several variables at once in one UDP packet. Unfortunately, it is not supported by all SNMP devices. Per default, check_mk uses bulk walk for all devices. If you come along devices not supporting bulk walk, please use this variable to define hosts supporting bulkwalk. Example: All hosts with the tag bulk support bulk walk, except the host broken123: bulkwalk_hosts = [ ( NEGATE, [ "broken123" ] ), ( ["bulk"], ALL_HOSTS ) ] Please note, that using bulk walk implies switching to SNMP v2c and also enabled 64 bit data types (needed for the checks if64, and df_netapp). snmpv2c_hostsNew in 1.1.13i3: This variable works similar to bulkwalk_hosts, but allows you to just select SNMP v2c without activating bulk walk at the same time. This is useful for a small number of broken devices that support v2c but behave badly when using bulk walk. snmp_portsNew in 1.1.11i2: This configuration variable allows you to specify the UDP port to be used for SNMP (on a per-host basis). Changing that port number is rarely needed, but if you are forced to use a non-standard port for some reason, well, you are forced to. Because we are not aware of any useful workaround to this problem, this option has been introduced. It is compatible to datasource_programs. The following example forces the port 555 to be used for all hosts having the tag dmz. Other hosts use the standard port: snmp_ports += [ ( 555, [ "dmz" ], ALL_HOSTS ), ] snmp_character_encodingsNew in 1.1.11i3: Some devices send texts in non-ASCII characters. Check_MK always assumes UTF-8 encoding, but some devices implicitely use other encodings, like latin1. It is now possible to declare such hosts in main.mk with their encodings, so that strings like Resttonerbehälter can be properly displayed. snmp_character_encodings works like datasource_programs. Example for western encoding: # Assume all devices with tags snmp and printer to use latin1 encoding snmp_character_encodings += [ ( "latin1", [ "snmp", "printer" ], ALL_HOSTS ), ] Note: There may still be some checks that do not honor this setting. If you find such a check, please contact the mailing list and post an SNMP-walk of such a device. usewalk_hostsUsing stored snmpwalks when checking SNMP hosts is a useful feature for testing, debugging and implementing checks. This can be triggered manually with the option --usewalk. If you want certain hosts to use stored checks in general, you can declare them in usewalk_hosts. Its syntax is identical to bulkwalk_hosts. Example (here without tags): usewalk_hosts = [ ( [ "testhost1", "testhost2" ] ), ] Cluster checksclustersDefinition of HA clusters. Default:
clusters = {}
clustered_servicesDefinition of services that should be considered as being clustered. Default: clustered_services = [] clustered_services_ofThis does the same as clustered_services but is a dictionary and allows you to explicitely specify a cluster, the services should be assigned to. You need this only if you clusters overlap. Example: clustered_services_of["ora02"] = ( ALL_HOSTS, [ "fs_/ora" ] ) ] cluster_max_cachefile_ageThe number of seconds a cache file may be old if check_mk should use it instead of getting information from the target hosts while checking a cluster. Per default this is enabled and set to 90 seconds. If your check cycle is not set to a larger value then one minute then you should increase this accordingly. Default: cluster_max_cachefile_age = 150 Service aggregationService aggregation is an advances feature that lets you aggregate several services of a host into a new service of a virtual summary host. service_aggregationsUsing this variable enables service aggregation. The default value is [], which disables service aggregation. Example: service_aggregations = [ ( "Logfiles", ALL_HOSTS, "LOG "), ( "Services", ALL_HOSTS, "service"), ( "Filesystems", [ "linux" ], ALL_HOSTS, "fs_" ), ( "Other", ALL_HOSTS, "" ), ] non_aggregated_hostsThis is a configuration list compatible to snmp_hosts that allows you to exclude certain hosts generally from service aggregation. Per default, all hosts are aggregated if service_aggregations is set and the host matches at least one host specification in that list (disregarding the services). Example: non_aggregated_hosts = [ # Exclude hosts with tag 'snmp' from aggregation ( [ "snmp" ], ALL_HOSTS ), # Exclude some explicit hosts (Trailing comma needed here!!) ( [ "abc123", "abc125" ], ) ] aggr_summary_hostnameSets the host name used for summary hosts. This string must contain exactly on %s, which will be replace with the base host name. The default value appends the suffix -s: aggr_summary_hostname = "%s-s" aggregation_output_formatNew in 1.1.6: When aggregating services, Check_MK usually used just OK - 7 services OK as check output if everything is OK and the texts of the non-OK services otherwise. You can switch to a detailed output using Nagios multiline plugin output when setting: aggregation_output_format = "multiline" Note: from version 1.1.9i1 the default setting will be "multiline". You may set it to "single" in order to get the previous behaviour. summary_host_groupsDoes the same as host_groups, but for summary hosts. summary_service_groupsDoes the same as service_groups, but for the aggregated services of summary hosts. summary_service_contactgroupsDoes the same as service_contactgroups, but for the aggregated services of summary hosts. aggregate_check_mkIf you set this variable to True, your summary hosts will get an additional passive service Check_MK. That service shows the same state and output of the original active service Check_MK on the real host. The default is False. Example: aggregate_check_mk = True |
| ||||||||||||||||||||||||||||||||