.TH check_mk 1 "23. Juni 2008" "MKNagios 1.0.0" "User Commands" .SH NAME check_mk - check plugin and administration tool of MKNagios .SH SYNOPSIS .B check_mk -d \fIHOST\fR .br .B check_mk [\fIOPTION\fR]... \fIHOSTNAME\fR [\fIIPADDRESS\fR] .br .B check_mk \-S|\-H .br .B check_mk \-I \fITYPES\fR [\fIHOST1\fR \fIHOST2\fR ...] .SH DESCRIPTION .B check_mk is the central tool for managing the configuration of MKNagios as well as for performing the actual checks. It is needed on the monitoring server only. .B check_mk has four different operation modes: \fITEST\fR, \fICHECK\fR, \fICONFIG\fR and \fIINVENTORY\fR. .SH TEST MODE The option \fI-d\fR selects test mode. The only argument in test mode is the ip iaddress or host name of a monitoring target, which has installed \fBmknagios\fR. In test mode \fBcheck_mk\fR tries to connect to the mknagios-agent on TCP port 6556 (or whatever port has been configured in \fBmknagios.cfg\fR). It outputs all data it got from the agent verbatim to stdout. In fact it is much the same as doing a "netcat HOST 5665". .TP 4 \fIExamples\fR check_mk -d xyhost123 .br check_mk -d 10.20.0.117 .SH CHECK MODE In check mode \fBcheck_mk\fR checks one of the hosts configured in the variable \fBall_hosts\fR in \fBmknagios.cfg\fR. Specify the name of the host as argument to check_mk. If the hostname is not resolvable via DNS then you have to specify the ip address as second argument. If the data aquisition is successfull (either via TCP or via SNMP), then all checks configured in \fBmknagios.cfg\fR are performed and the results are submitted to Nagios via passive service checks. .TP 4 \fIExample 1:\fR check host with DNS lookup: check_mk xyhost123 .TP \fIExample 2:\fR check host wihtout DNS lookup: check_mk xyhost123 10.0.11.18 .PP Hint: When integrating into Nagios, \fBalways\fR provide an ip address. A command definition should look like this: .nf define command { command_name check-mk command_line /usr/bin/check_mk $HOSTNAME$ $HOSTADDRESS$ } .fi .SH OPTIONS (CHECK MODE) .TP \fB\-v\fR, \fB\-\-verbose\fR Verbose operation: Show steps of data aquisition, show results of checks .TP \fB\-p\fR Also show performance data - only useful in combination with \fB\-v\fR. .TP \fB\-n\fR Do \fBnot\fR submit check results to Nagios, just check. This option is almays always used in combination with \fB\-v\fR (check_mk \-nv somehost) .SH CONFIGURATION MODE check_mk can create configuration data for Nagios for you. This is very useful, especially for the configuration of the services. Configuration output is selected via option \-S and/or \-H: .TP \fB-H\fR Output host configuration suitable for Nagios for all hosts listed in \fBall_hosts\fR. You might want to redirect stdout into a file lying within your object econfiguration directory of Nagios. The host definitions for the refer to the template \fBmknagios-host\fR. You have to define that template somewhere in your nagios configuration. The value of \fBhost_groups\fR is set according to \fBall_hosts\fR. The ip addresses of the hosts are computed automatically via DNS lookups. .PP \fIExample\fR: Let's assume your \fBall_hosts\fR in \fBmknagios.cfg\fR looks like this: .nf all_hosts = [ ("Heuberg", "linux-servers"), ("SW18_F1", "switches") ] .fi Then the output of \fBcheck_mk -H\fR will be: .nf define host { use mknagios_host host_name Heuberg alias Heuberg host_groups linux-servers address 10.10.1.4 } define host { use mknagios_host host_name SW18_F1 alias SW18_F1 host_groups switches address 10.12.0.18 } .fi .TP \fB-S\fR Output service configuration to stdout. For each host listed in \fBall_hosts\fR one active service check is being output. For each check listed in \fBchecks\fR one passive service check is being output. The service definitions each refer to one of the following three templates, which you have to define manually within your Nagios configuration: .TP mknagios_active Active checks: The check_command must be \fBcheck-mk\fR with a definition as previously shown in this man page. .TP mknagios_passive Template for passive checks without performance data .TP mknagios_passive_perf Template for passive checks with performance data. Your definition of this template should have \fBprocess_perf_data\fR set to \fB1\fR and should have an \fBaction_url\fR (i.e. if you want to process performance data at all). In addition to the service definitions there are output dummy commands for all different passive check types. That way you are able to determine the check type in graphing tools like PNP4Nagios. \fIExample\fR: Let's assume your \fBall_hosts\fR in \fBmknagios.cfg\fR looks like this: .nf checks = [ ("Heuberg", "df", "/", (80, 90) ), ("Heuberg", "cpu.load", "5min", None ), ] .fi Then the output of \fBcheck_mk -H\fR will be: .nf define service { use mknagios_active host_name Heuberg service_description MK Nagios } define service { use mknagios_passive_perf host_name Heuberg service_description fs_/ check_command mknagios-df } define service { use mknagios_passive_perf host_name Heuberg service_description CPU load 5min check_command mknagios-cpu.load } define service { use mknagios_active host_name SW18_F1 service_description MK Nagios } define command { command_name mknagios-df command_line false } define command { command_name mknagios-cpu.load command_line false } .fi .PP You can combine \-S and \-H in order to have output all configuration data at once, for example: \fBcheck_mk -SH > /etc/nagios/object/mknagios_data.cfg\fR. .SH INVENTORY MODE One of the key features of check_mk is its inventory funtionality. It is selected by the option \fB\-I\fR. That option needs an argument: one ore more comma separated check types, for that inventory should be done. \fBcheck_mk \-I list\fR shows you a list of all check types that support inventory. As optional argument you can specify one or more hosts for which inventory should be done. These hosts must be contained in \fBall_hosts\fR. If you use \fB\-I\fR without hosts, all hosts in \fBall_hosts\fR will be processed. .TP \fIExample 1:\fR Do inventory for df and md for all hosts: check_mk -I df,md .TP \fIExample 2:\fR Do inventory for ipmi an hosts ab01f01 und ab01f02: check_mk -I ipmi ab01f01 ab01f02 .PP The inventory is looking for data items on hosts that are not yet being checked (e.g. neu partitions, networks interfaces and so on). For those items check configurations are created in a file in the directory /etc/nagios/autochecks. You may edit those files in order to change check parameters. The format of the tables in those files is identical to the format of the variable \fBchecks\fR. After an inventory found new checks, you need to update the nagios configuration (see option \fB\-I\fR) and restart Nagios. .SH MISC OPTIONS .TP \-L Output table of all available check types.