Letzte Aktualisierung: 18. Januar 2011
When you call check_mk, you have to specify exactly
one of the following major operating modes:
||Check mode: performs and immediate check on a host. Required argument is the name of the
host. If the hostname is not resolvable into an IP address via /etc/hosts or
DNS you can specify its IP address as an additional argument. This is the preferred
way when check_mk is called by Nagios and if you do not use precompiled host checks.
The results of the
check are not displayed until you use the option -v. But the results are
sent to Nagios via its command pipe - unless you suppress this with the option
-n. The option -p - if used together with -v
also displays performance data of the checks.
The exit status of check_mk in Check mode adheres to the Nagios convention
for checks: 0 means OK, 1 means warning, 2 means critical and 3 means unknown.
in Inventory on one or all hosts. One argument is required:
the check types to make inventory for. Multiple types are separated with
commas (for example df,multipath,md). Alternatively you can
use tcp which means "all non-SNMP checks".|
If you do not specify a hostname, the inventory will be done on all
hosts. Multiple hostnames are separated by spaces. Example: check_mk -I df,multipath hostab1 hostab2
||Checks if an inventory of HOSTNAME would yield new checks. Behaves like
a standard Nagios plugin: Outputs one line of text and exits with
0, 1, 2 or 3. Please look at Inventory Checks for details.|
|-N||[HOST(s)...]||New in 1.1.7i2. This option replaces
the old options -H and -S and is mainly used for debugging and checking the
result of the config creation. It outputs the configuration which Check_MK creates for Nagios
if called with -U, -O or -R. If you specify one or more host names as argument,
only those hosts (and their services and groups) will be reflected in the output.|
|-C||--compile||Creates one specialized Python executable
for each host and byte compiles that. The Python source code and the byte compiled files are created in
the directory precompiled which is usually located under /var/lib/check_mk.
Those files are called by Nagios for checking this hosts.
As it saves a lot of ressources, this is the default method:
Using precompiled host checks is much faster then doing checks by calling check_mk,
but does the same. The precompiled file has embedded all code and configuration that
is needed for the actual check. It is completely standalone and does not depend on any
other configuration or Python file. The precompiled check accept only one option: -v.
You do not need to specify an IP address when checking: it is compiled into the check.
After changing configuration files, check parameters in autocheck files or doing
an inventory you always needs to call check_mk -C in order to recreated the
precompiled host checks.
|-U||--update||This is a convenience option
that does the same as -N and -C. The output of -N
is not written to stdout but into a file. The default name of that file is check_mk_objects.cfg.
It is created in a directory specified at setup - usually directly where it belong: in the Nagios objects
directory. So after each change you just have to call:|
check_mk -C && /etc/init.d/nagios restart.
You can override the complete path to the file in main.mk with the configuration
|-R||--restart||This option is even more
convenient: It creates a new Nagios configuration just as -N. Then it does a
Nagios configuration check (by calling Nagios with the option -v). Only if that
check is successfull, the host checks will be precompiled (like option -C) and
Nagios is restarted (by calling its startscript with restart).
If the configuration
check fails, the old Nagios configuration will be restored and no precompilation will
be done. Thus the current configuration of Nagios keeps running.
|-P||--package||This option will take check_mk to the packager mode, which allows
installing custom extensions!
|-O||--reload||New in 1.1.7i5 This option does the same
as -R but does only reload Nagios. This is usually sufficient and
faster than restarting.|
|-d||HOSTNAME||Debug: Get and print output from agent.
This mode fetches the complete output from the check_mk_agent running on HOSTNAME and shows its output.
The default way is by connecting to TCP port 6556, but you might have specified a datasource program
for that host, which will be honored by -d.
|--backup||FILENAME||Creates a backupfile FILENAME containing
all configuration and runtime data of your check_mk installation. |
|--restore||FILENAME||Restores the backupfile FILENAME which
was previously created with --backup on your or any other installation of check_mk.|
|--flush||[HOST(S)]||Delete runtime data and (since version 1.1.10) also autochecks
belonging to the specified hosts. If no host is specified, data of all hosts will be deleted.
This includes performance counters, cache files and stored logfiles. |
|--snmpwalk||HOST(S)||1.1.7i1 This command does a complete SNMP walk on
all of the specified hosts and stores the results under /var/lib/check_mk/snmpwalks. Both the standard MIB
and enterprises MIB are fetched. That data can later be used instead of real SNMP data by specifying --usewalk
when doing an inventory or check.|
|--snmpget=OID||[HOST(S)]||1.1.10 Fetches a single SNMP OID from one,
several or (if you specify no host) all hosts. This honors all SNMP settings like bulkwalk_hosts, the community and so on.
This option is useful for testing and debugging, especially when writing scan functions.|
|--scan-parents||[HOST(S)]||1.1.7i2 This command uses
traceroute in order to automatically determine the parents of all hosts. It creates (and overwrites)
the configuration file conf.d/parents.mk. Please refer to the documentation for automatic scanning of parents for details.
|--list-hosts||[HOSTGROUP(S)]||Prints out all hosts. If
you specify one or more hostgroups then just the hosts of those groups are printed. The
output is plain, so that it can easily processed in scripts.|
|--list-tag||[TAG(S)]||Prints out all hosts have certain
tags. If you do not specify any tag then all hosts are printed. If you specify more than
one tag then only those hosts are listed that have all specified tags.|
|--donate||is for those who decided to help the Check_MK project
by donating live host data. It tars the cached agent data of
those host which are configured in main.mk:donation_hosts and sends
them via email to email@example.com. Have a look at Donatehosts for more information.
(turned off by default)
|-D||--dump||[HOST(S)]||Dumps all configuration information
about all or only about one or more specified hosts. The output is useful for debugging your configuration.|
|-L||--list-checks||Output a list of all check types
that are supported by your version of check_mk.|
|-M||--man||CHECKTYPE||Shows the builtin manual page for
a specified check type. Currently not all check types have manual pages.|
|--paths||List various installation, configuration and data
paths of Check_MK and Nagios.|
|-X||--config-check||Read your configuration files and check them for
invalid variables. The exit code of check_mk is 1 in case of an error and otherwise 0.
Note: Custom variables should be prefixed with _.|
|-V||--version||Prints your version of check_mk and exists.|
|-h||--help||Prints a short help of all options and exists.|
|-v||Makes the output of several operations more verbose. This is
also the only option the precompiled checks recognize.|
the checks' performance data (only in check mode and together with -v).|
|-n||Only in check mode: dry run - do not send data to
Nagios, do not update stored counters. You usually combine this with -v in check mode for debugging.|
|-c||FILE||Read configuration from FILE instead of the
standard main.mk. This is useful for testing alternativ versions of your main.mk file.
The conf.d directory is searched in the same directory as FILE. See Configuration files for more information about how the configuration files are read.|
|--cache||Force usage of cache files if present: In check
mode the output from the agent is always stored in a cache file (if running with the same user as Nagios).
That cache file is only used in inventory mode. With this option you can force check_mk to use an existing
cache file and thus prevent contacting the agent.|
|--no-tcp||This is similar to --cache but
suppresses contacting the agent even if no cache file is present.|
|--no-cache||In inventory mode check_mk uses data from
cached agent outputs from previous checks if present - regardless of their age. This option forces check_mk
to get fresh information from the agent even if a cache file is present.|
While this might be useful for inventorizing single hosts
it can be deadly (in terms of execution time) for a large number of hosts.
|--fake-dns||IPADDRESS||Suppresses hostname resolution in general
and forces all hosts to have IP address IPADDRESS. This has the effect that for all configured hosts only one
and the same real host is contacted. This allows you to simulate a large number of hosts or test the creation of Nagios
configuration files for a main.mk not matching your existing hosts.|
|--usewalk||1.1.7i1 Rather than doing a real SNMP walk get the data from a file
created with --snmpwalk stored in /var/lib/check_mk/snmpwalks. This helps writing and
debugging checks without access to real hardware.|
|--debug||This options help when looking for
error in the Python code of the module or the checks. It prevents catching exceptions. Any
exception will abort the program and display a complete track trace.|
|--procs||N||1.1.7i2 Sets the maximum number
of parallel processes to start during --scan-parents to N.|