MK's Remote Plugin Executor
April 21. 2014
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 usefull. For example:
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
Comments and empty lines are allowed. The following example configures five plugins to be executed:
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
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)
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:
perfdata_format = "pnp"
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:
1.2.5i1 Werk #0265 - mpre_include: run additional mrpe configs within user context
This version brings the new local check mrpe_include where you can configure additional include files for mrpe and under which user context the commands of these files are run. It allows non-root users to add additional mrpe commands without modifying the mrpe.cfg file. You can assign include files to users and define in which user context the commands should be executed.
This check is configured with the configuration file mrpe_include.cfg. In a default installation this file is located within the Check_MK config directory under /etc/check_mk/mrpe_include.cfg.
The mrpe_include.cfg does not contain the new mrpe commands, though a user name followed by a include path. Here is an example:
# Execute as user ab ab /etc/check_mk/mrpe_ab_commands.cfg # Execute as user lm lm /etc/other/mrpe_lm.cfg # Execute with no user context change - /etc/mrpe_default.cfg
Each line consists of two parameters, the user followed by the include file. Each command within the include file is executed as this user. If you do not want to change the user context (default is root), you can set the user to -. The included files have the same configuration syntax as the mrpe.cfg.