1 # <a id="service-monitoring"></a> Service Monitoring
3 The power of Icinga 2 lies in its modularity. There are thousands of
4 community plugins available next to the standard plugins provided by
5 the [Monitoring Plugins project](https://www.monitoring-plugins.org).
7 ## <a id="service-monitoring-requirements"></a> Requirements
9 ### <a id="service-monitoring-plugins"></a> Plugins
11 All existing Nagios or Icinga 1.x plugins work with Icinga 2. Here's a
12 list of popular community sites which host check plugins:
14 * [Icinga Exchange](https://exchange.icinga.org)
15 * [Icinga Wiki](https://wiki.icinga.org)
17 The recommended way of setting up these plugins is to copy them to a common directory
18 and create a new global constant, e.g. `CustomPluginDir` in your [constants.conf](4-configuring-icinga-2.md#constants-conf)
21 # cp check_snmp_int.pl /opt/monitoring/plugins
22 # chmod +x /opt/plugins/check_snmp_int.pl
24 # cat /etc/icinga2/constants.conf
26 * This file defines global constants which can be used in
27 * the other configuration files. At a minimum the
28 * PluginDir constant should be defined.
31 const PluginDir = "/usr/lib/nagios/plugins"
32 const CustomPluginDir = "/opt/monitoring/plugins"
34 Prior to using the check plugin with Icinga 2 you should ensure that it is working properly
35 by trying to run it on the console using whichever user Icinga 2 is running as:
37 # su - icinga -s /bin/bash
38 $ /opt/monitoring/plugins/check_snmp_int.pl --help
40 Additional libraries may be required for some plugins. Please consult the plugin
41 documentation and/or plugin provided README for installation instructions.
42 Sometimes plugins contain hard-coded paths to other components. Instead of changing
43 the plugin it might be easier to create logical links which is (more) update-safe.
45 Sometimes there are plugins which do not exactly fit your requirements.
46 Either you'll modify an existing plugin or you'll write one by yourself.
48 ### <a id="service-monitoring-plugin-checkcommand"></a> CheckCommand Definition
50 Each plugin requires a [CheckCommand](9-object-types.md#objecttype-checkcommand) object in your
51 configuration which can be used in the [Service](9-object-types.md#objecttype-service) or
52 [Host](9-object-types.md#objecttype-host) object definition.
54 Please check if the Icinga 2 package already provides an
55 [existing CheckCommand definition](10-icinga-template-library.md#plugin-check-commands).
56 If yes throroughly check the required parameters and integrate the check command
57 into your host and service objects.
59 There are the following conventions to follow when adding a new command object definition:
61 * Always import the `plugin-check-command` template
62 * Use [command-arguments](#) whenever possible. The `command` attribute must be an array
63 in `[ ... ]` then for shell escaping.
64 * Define a unique `prefix` for the command's specific command arguments. That way you can safely
65 set them on host/service level and you'll always know which command they control.
66 * Use command argument default values, e.g. for thresholds
67 * Use [advanced conditions](9-object-types.md#objecttype-checkcommand) like `set_if` definitions.
69 Example for a custom `my-snmp-int` check command:
71 object CheckCommand "my-snmp-int" {
72 import "plugin-check-command"
74 command = [ CustomPluginDir + "/check_snmp_int.pl" ]
77 "-H" = "$snmp_address$"
78 "-C" = "$snmp_community$"
83 "-n" = "$snmp_interface$"
85 set_if = "$snmp_perf$"
93 vars.snmp_warn = "300,400"
94 vars.snmp_crit = "0,600"
98 For further information on your monitoring configuration read the
99 [Monitoring Basics](3-monitoring-basics.md#monitoring-basics) chapter.
101 If you have created your own `CheckCommand` definition please kindly
102 [send it upstream](https://wiki.icinga.org/display/community/Contribute+Icinga+2+ITL+Plugin+Check+Command+Definitions)
104 ### <a id="service-monitoring-plugin-api"></a> Plugin API
106 Currently Icinga 2 supports the native plugin API specification from the `Monitoring Plugins`
109 The `Monitoring Plugin API` is defined in the [Monitoring Plugins Development Guidelines](https://www.monitoring-plugins.org/doc/guidelines.html).
111 ## <a id="service-monitoring-overview"></a> Service Monitoring Overview
113 The following examples should get you started with your own integration ideas.
114 There is a variety of common plugins available. This collection is not complete --
115 if you have any updates please send a documentation patch upstream.
117 ## <a id="service-monitoring-general"></a> General Monitoring
119 If the remote service is available using a network protocol and port,
120 and a check plugin is available, you don't necessarily need a local client installed.
121 Rather choose a plugin and configure all parameters and thresholds. The [Icinga 2 Template Library](10-icinga-template-library.md#icinga-template-library)
122 already ships various examples like
124 * [ping4](10-icinga-template-library.md#plugin-check-command-ping4), [ping6](10-icinga-template-library.md#plugin-check-command-ping6),
125 [fping4](10-icinga-template-library.md#plugin-check-command-fping4), [fping6](10-icinga-template-library.md#plugin-check-command-fping6), [hostalive](10-icinga-template-library.md#plugin-check-command-hostalive)
126 * [tcp](10-icinga-template-library.md#plugin-check-command-tcp), [udp](10-icinga-template-library.md#plugin-check-command-udp), [ssl](10-icinga-template-library.md#plugin-check-command-ssl)
127 * [ntp_time](10-icinga-template-library.md#plugin-check-command-ntp-time)
129 ## <a id="service-monitoring-linux"></a> Linux Monitoring
131 * [disk](10-icinga-template-library.md#plugin-check-command-disk)
132 * [mem](10-icinga-template-library.md#plugin-contrib-command-mem), [swap](10-icinga-template-library.md#plugin-check-command-swap)
133 * [running_kernel](10-icinga-template-library.md#plugin-contrib-command-running_kernel)
134 * Package repositores ([apt](10-icinga-template-library.md#plugin-check-command-apt), [yum](10-icinga-template-library.md#plugin-contrib-command-yum), etc.)
135 * [ssh](10-icinga-template-library.md#plugin-check-command-ssh)
136 * Performance ([iostat](10-icinga-template-library.md#plugin-contrib-command-iostat), [check_sar_perf](https://github.com/dnsmichi/icinga-plugins/blob/master/scripts/check_sar_perf.py))
138 ## <a id="service-monitoring-windows"></a> Windows Monitoring
140 * [check_wmi_plus](http://www.edcint.co.nz/checkwmiplus/)
141 * [NSClient++](https://www.nsclient.org) (in combination with the Icinga 2 client as [nscp-local](10-icinga-template-library.md#nscp-plugin-check-commands) check commands)
142 * [Icinga 2 Windows Plugins](10-icinga-template-library.md#windows-plugins) (disk, load, memory, network, performance counters, ping, procs, service, swap, updates, uptime, users
143 * vbs and Powershell scripts
145 ## <a id="service-monitoring-database"></a> Database Monitoring
147 * MySQL ([mysql_health](10-icinga-template-library.md#plugin-contrib-command-mysql_health), [mysql](10-icinga-template-library.md#plugin-check-command-mysql), [mysql_query](10-icinga-template-library.md#plugin-check-command-mysql-query))
148 * PostgreSQL ([postgres](10-icinga-template-library.md#plugin-contrib-command-postgres))
149 * Oracle ([oracle_health](10-icinga-template-library.md#plugin-contrib-command-oracle_health))
150 * MSSQL ([mssql_health](10-icinga-template-library.md#plugin-contrib-command-mssql_health))
151 * DB2 ([db2_health](10-icinga-template-library.md#plugin-contrib-command-db2_health))
152 * MongoDB ([db2_health](10-icinga-template-library.md#plugin-contrib-command-mongodb))
153 * Elasticsearch ([db2_health](10-icinga-template-library.md#plugin-contrib-command-elasticsearch))
154 * Redis ([db2_health](10-icinga-template-library.md#plugin-contrib-command-redis))
156 ## <a id="service-monitoring-snmp"></a> SNMP Monitoring
158 * [Manubulon plugins](10-icinga-template-library.md#snmp-manubulon-plugin-check-commands) (interface, storage, load, memory, process)
159 * [snmp](10-icinga-template-library.md#plugin-check-command-snmp), [snmpv3](10-icinga-template-library.md#plugin-check-command-snmpv3)
161 ## <a id="service-monitoring-network"></a> Network Monitoring
163 * [nwc_health](10-icinga-template-library.md#plugin-contrib-command-nwc_health)
164 * [interfaces](10-icinga-template-library.md#plugin-contrib-command-interfaces)
165 * [interfacetable](10-icinga-template-library.md#plugin-contrib-command-interfacetable)
166 * [iftraffic](10-icinga-template-library.md#plugin-contrib-command-iftraffic), [iftraffic64](10-icinga-template-library.md#plugin-contrib-command-iftraffic64)
168 ## <a id="service-monitoring-web"></a> Web Monitoring
170 * [http](10-icinga-template-library.md#plugin-check-command-http)
171 * [ftp](10-icinga-template-library.md#plugin-check-command-ftp)
172 * [webinject](10-icinga-template-library.md#plugin-contrib-command-webinject)
173 * [squid](10-icinga-template-library.md#plugin-contrib-command-squid)
174 * [apache_status](10-icinga-template-library.md#plugin-contrib-command-apache_status)
175 * [nginx_status](10-icinga-template-library.md#plugin-contrib-command-nginx_status)
176 * [kdc](10-icinga-template-library.md#plugin-contrib-command-kdc)
177 * [rbl](10-icinga-template-library.md#plugin-contrib-command-rbl)
179 ## <a id="service-monitoring-java"></a> Java Monitoring
181 * [jmx4perl](10-icinga-template-library.md#plugin-contrib-command-jmx4perl)
183 ## <a id="service-monitoring-dns"></a> DNS Monitoring
185 * [dns](10-icinga-template-library.md#plugin-check-command-dns)
186 * [dig](10-icinga-template-library.md#plugin-check-command-dig)
187 * [dhcp](10-icinga-template-library.md#plugin-check-command-dhcp)
189 ## <a id="service-monitoring-backup"></a> Backup Monitoring
191 * [check_bareos](https://github.com/widhalmt/check_bareos)
193 ## <a id="service-monitoring-log"></a> Log Monitoring
195 * [check_logfiles](https://labs.consol.de/nagios/check_logfiles/)
196 * [check_logstash](https://github.com/widhalmt/check_logstash)
197 * [check_graylog2_stream](https://github.com/Graylog2/check-graylog2-stream)
199 ## <a id="service-monitoring-virtualization"></a> Virtualization Monitoring
201 * [esxi_hardware](10-icinga-template-library.md#plugin-contrib-command-esxi-hardware)
202 * [VMWare](10-icinga-template-library.md#plugin-contrib-vmware)
204 ## <a id="service-monitoring-sap"></a> SAP Monitoring
206 * [check_sap_health](https://labs.consol.de/nagios/check_sap_health/index.html)
207 * [SAP CCMS](https://sourceforge.net/projects/nagios-sap-ccms/)
209 ## <a id="service-monitoring-mail"></a> Mail Monitoring
211 * [smtp](10-icinga-template-library.md#plugin-check-command-smtp), [ssmtp](10-icinga-template-library.md#plugin-check-command-ssmtp)
212 * [imap](10-icinga-template-library.md#plugin-check-command-imap), [simap](10-icinga-template-library.md#plugin-check-command-simap)
213 * [pop](10-icinga-template-library.md#plugin-check-command-pop), [spop](10-icinga-template-library.md#plugin-check-command-spop)
215 ## <a id="service-monitoring-hardware"></a> Hardware Monitoring
217 * [hpasm](10-icinga-template-library.md#plugin-contrib-command-hpasm)
218 * [ipmi-sensor](10-icinga-template-library.md#plugin-contrib-command-ipmi-sensor)
220 ## <a id="service-monitoring-metrics"></a> Metrics Monitoring
222 * [graphite](10-icinga-template-library.md#plugin-contrib-command-graphite)