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

70 lines
2.8 KiB
Markdown
Raw Normal View History

## <a id="setting-up-check-plugins"></a> Setting up Check Plugins
On its own Icinga 2 does not know how to check external services. The
2014-03-30 11:52:39 +02:00
[Monitoring Plugins Project](https://www.monitoring-plugins.org/) 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**
>
2014-03-30 11:52:39 +02:00
> 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:
2013-10-10 12:32:50 +02:00
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
2014-03-31 13:27:39 +02:00
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
2013-10-10 12:32:50 +02:00
where to find the plugin binaries.
2013-10-18 20:05:08 +02:00
### <a id="integrate-additional-plugins"></a> Integrate Additional Plugins
2013-10-18 20:05:08 +02:00
2014-03-30 11:52:39 +02:00
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:
2013-10-18 20:05:08 +02:00
* [MonitoringExchange](https://www.monitoringexchange.org)
* [Icinga Wiki](https://wiki.icinga.org)
2013-10-18 20:05:08 +02:00
2014-03-30 11:52:39 +02:00
The recommended way of setting up these plugins is to copy them to a common directory
2014-03-31 13:27:39 +02:00
and creating an extra global constant, e.g. `CustomPluginDir` in your `constants.conf`
2014-03-30 11:52:39 +02:00
configuration file:
2013-10-18 20:05:08 +02:00
2014-03-30 11:52:39 +02:00
# cp check_snmp_int.pl /opt/plugins
# chmod +x /opt/plugins/check_snmp_int.pl
2014-03-31 13:27:39 +02:00
# cat /etc/icinga2/constants.conf
2014-03-30 11:52:39 +02:00
/**
2014-03-31 13:27:39 +02:00
* This file defines global constants which can be used in
* the other configuration files. At a minimum the
* PluginDir constant should be defined.
2014-03-30 11:52:39 +02:00
*/
2014-03-31 13:27:39 +02:00
const PluginDir = "/usr/lib/nagios/plugins"
const CustomPluginDir = "/opt/monitoring"
2014-03-30 11:52:39 +02:00
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
2013-10-18 20:05:08 +02:00
> **Note**
>
2014-03-31 12:00:10 +02:00
> Additional libraries may be required for some plugins. Please consult the plugin
> documentation and/or README for installation instructions.