MK's Remote Plugin Executor


Dieser Artikel wird nicht mehr gepflegt und ist unter Umständen nicht mehr gültig!

1. Calling Nagios Plugins

Calling standard Nagios plugins next to check_mk on the Nagios host is straight forward: Just do it as you did before check_mk. Check_mk and standard plugins perfectly work side by side.

Calling Nagios plugins on a target host is another thing. Check_mk tries hard to make those plugins unneccessary. In some cases, however, they are still useful. For example:

  1. If you want a soft migration from NRPE to check_mk
  2. If you want to use third party plugins for specialized kinds of checks.

2. Using MRPE to call Nagios Plugins

As of check_mk version 1.0.36 the Linux and UNIX agents have integrated MRPE. With MRPE It is very easy to let Nagios plugins be called from the agent. All you need is a small configuration file mrpe.cfg and - well - the plugins you want ot call. The file mrpe.cfg must be located in the agent's configuration directory (at the same place where logwatch.cfg lies). If you did not change that at setup, the complete path is /etc/check_mk/mrpe.cfg.

Each line in mrpe.cfg configures one plugin to be executed. It consists of

  1. a service description without spaces
  2. the complete command line for calling the plugin

Comments and empty lines are allowed. The following example configures five plugins to be executed:

/etc/check_mk/mrpe.cfg
LOAD      /usr/lib/nagios/plugins/check_load -w 2 -c 5
FS_var    /usr/lib/nagios/plugins/check_disk /var
FS_hirn   /usr/lib/nagios/plugins/check_disk /hirn
Aptitude  /usr/lib/nagios/plugins/check_apt
Smart_sda /usr/lib/nagios/plugins/check_ide_smart -d /dev/sda -n

After having created that file, the next inventory of that host will find and automatically configure five new checks. The check type for that is mrpe:

root@linux# cmk -I --checks=mrpe somehost123
mrpe                  5 new checks

If you are curious about how the MRPE section in the output of the agent looks like - here is an example:

root@linux# check_mk -d somehost123 | grep -A5 mrpe
<<<mrpe>>>
LOAD 0 OK - load average: 0.31, 0.27, 0.20|load1=0.310;2.000;5.000;0; load5=...
FS_var 0 DISK OK - free space: / 133783 MB (75% inode=97%);| /=42731MB;;;0;185961
FS_hirn 2 DISK CRITICAL - /hirn is not accessible: No such file or directory
Aptitude 0 APT OK: 0 packages available for upgrade (0 critical updates).
Smart_sda 0 OK - Operational (19/19 tests passed)

2.1. Performance data

You need not worry about performance data. All performance output by the plugins is transparently transported to Nagios, as long as it is compatible with the standardized Nagios format for performance data.

1.1.4: If you are using PNP4Nagios, you can let Check_MK help it to choose a matching template. This is done by appending the name of the original check to the performance data. You need an up-to-date agent for that (currently supported only on Linux). All you have to do is to add to your main.mk:

main.mk
perfdata_format = "pnp"

3. Using MRPE on localhost

Since using MRPE is very easy, you might want to use it for standard Plugins to be called on the Nagios server itself. This can easily be done by creating a mrpe.cfg on your Nagios machine and inventorizing localhost. Before you do this, however, please make sure that you've understood some limitations:

  • All plugins on localhost are called at the same time - once per cycle. There is no way to call some more often than others.
  • The plugins are called in direct sequence - one after another. No parallelization takes place.
Those restrictions normally do not harm if you use MRPE to execute just a few checks. If you use MRPE on localhost for doing lots of checks that might possibly hang or need a longer time to execute, you could run into the problem that the agent's execution time is longer than your check cycle (usually one minute).