You are here

Using check_mk as an agent to monitor a linux server

Adding check_mk to our Nagios server was easy so I went on to install the check_mk agent on one of our servers.

For this installation I choose to take the rpm install path following the description on the check_mk site. The maxwait mentioned in the documentation is installed by the rpm.

A minor item missing in this desciption is that it may be necessary to open port 6556 in the firewall configuration.

What I'm missing from the documentation is what to do once the agent is installed. On the nagios server I tried

check_mk -I devsrv02

but that resulted in

Hostname or tag specification 'devsrv02' does not match any host.

after some searching I figured out I had to add my host to /etc/check_mk/ One crucial line 'add the host to all_hosts in' is present in the documentation for the windows agent but missing from the linux agent install.

After fixing check_mk shows new checks

# check_mk -I devsrv02
cpu.loads         1 new checks
cpu.threads       1 new checks
df                2 new checks
diskstat          1 new checks
kernel            3 new checks
kernel.util       1 new checks
lnx_if            2 new checks
mem.used          1 new checks
mounts            2 new checks
postfix_mailq     1 new checks
tcp_conn_stats    1 new checks
uptime            1 new checks

Next I tried to reload the Nagios configuration

check_mk -O
Generating Nagios configuration...OK
Validating Nagios configuration...ERROR:

Nagios Core 3.3.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 07-25-2011
License: GPL

Reading configuration data...
   Read main config file okay...
... trimmed
Processing object config file '/usr/local/nagios/etc/conf.d/devsrv02.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/check_mk_objects.cfg'...
Warning: Duplicate definition found for host 'devsrv02' (config file '/usr/local/nagios/etc/conf.d/check_mk_objects.cfg', starting on line 10)
Error: Could not add object property in file '/usr/local/nagios/etc/conf.d/check_mk_objects.cfg' on line 11.
   Error processing object config files!

***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
... trimmed

Nagios configuration is invalid. Rolling back.
An error occurred: 1

There was no agent running on that server before I installed check_mk but I had one check (check_cups_queue) configured for that server before. I could remove that from the existing Nagios configuration but I decided I would try to change check_mk setup.

After a (short) check of the check_mk documentation I could not find an option to add a host to check_mk that would not be written as a host to the nagios configuration. To solve I commented out the host definition from the original Nagios config, without removing the service checks.  

# check_mk -O
Generating Nagios configuration...OK
Validating Nagios configuration...OK
Precompiling host checks...OK
Reloading Nagios...OK

A new linux host

The screenshot shows the devsrv02 with the original CUPS Queue service check and those added automatically by check_mq. I'll be playing around with this some more but I'm already convinced I'll be moving our checks to check_mk.