icinga2/doc/2.2-setting-up-check-plugin...

2.8 KiB

Setting up Check Plugins

On its own Icinga 2 does not know how to check external services. The Monitoring Plugins Project provides an extensive set of plugins which can be used with Icinga 2 to check whether services are working properly.

The recommended way of installing these standard plugins is to use your distribution's package manager.

Note

The Nagios Plugins project was renamed to Monitoring Plugins in January 2014. At the time of this writing the packages are still using the old name.

For your convenience here is a list of package names for some of the more popular operating systems/distributions:

OS/Distribution Package Name Installation Path
RHEL/CentOS (EPEL) nagios-plugins-all /usr/lib/nagios/plugins or /usr/lib64/nagios/plugins
Debian nagios-plugins /usr/lib/nagios/plugins
FreeBSD nagios-plugins /usr/local/libexec/nagios
OS X (MacPorts) nagios-plugins /opt/local/libexec

Depending on which directory your plugins are installed into you may need to update the global PluginDir constant in your Icinga 2 configuration. This macro is used by the service templates contained in the Icinga Template Library to determine where to find the plugin binaries.

Integrate Additional Plugins

For some services you may need additional check plugins which are not provided by the official Monitoring Plugins project.

All existing Nagios or Icinga 1.x plugins should work with Icinga 2. Here's a list of popular community sites which host check plugins:

The recommended way of setting up these plugins is to copy them to a common directory and create an extra global constant, e.g. CustomPluginDir in your constants.conf configuration file:

# cp check_snmp_int.pl /opt/plugins
# chmod +x /opt/plugins/check_snmp_int.pl

# cat /etc/icinga2/constants.conf
/**
 * This file defines global constants which can be used in
 * the other configuration files. At a minimum the
 * PluginDir constant should be defined.
 */

const PluginDir = "/usr/lib/nagios/plugins"
const CustomPluginDir = "/opt/monitoring"

Prior to using the check plugin with Icinga 2 you should ensure that it is working properly by trying to run it on the console using whichever user Icinga 2 is running as:

# su - icinga -s /bin/bash
$ /opt/plugins/check_snmp_int.pl --help

Additional libraries may be required for some plugins. Please consult the plugin documentation and/or README for installation instructions.