]> granicus.if.org Git - icinga2/blob - doc/5-service-monitoring.md
Docs: Rewrite cluster and client chapter from scratch; add service monitoring chapter
[icinga2] / doc / 5-service-monitoring.md
1 # <a id="service-monitoring"></a> Service Monitoring
2
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).
6
7 ## <a id="service-monitoring-requirements"></a> Requirements
8
9 ### <a id="service-monitoring-plugins"></a> Plugins
10
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:
13
14 * [Icinga Exchange](https://exchange.icinga.org)
15 * [Icinga Wiki](https://wiki.icinga.org)
16
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)
19 configuration file:
20
21     # cp check_snmp_int.pl /opt/monitoring/plugins
22     # chmod +x /opt/plugins/check_snmp_int.pl
23
24     # cat /etc/icinga2/constants.conf
25     /**
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.
29      */
30
31     const PluginDir = "/usr/lib/nagios/plugins"
32     const CustomPluginDir = "/opt/monitoring/plugins"
33
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:
36
37     # su - icinga -s /bin/bash
38     $ /opt/monitoring/plugins/check_snmp_int.pl --help
39
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.
44
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.
47
48 ### <a id="service-monitoring-plugin-checkcommand"></a> CheckCommand Definition
49
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.
53
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.
58
59 There are the following conventions to follow when adding a new command object definition:
60
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.
68
69 Example for a custom `my-snmp-int` check command:
70
71     object CheckCommand "my-snmp-int" {
72       import "plugin-check-command"
73
74       command = [ CustomPluginDir + "/check_snmp_int.pl" ]
75
76       arguments = {
77         "-H" = "$snmp_address$"
78         "-C" = "$snmp_community$"
79         "-p" = "$snmp_port$"
80         "-2" = {
81           set_if = "$snmp_v2$"
82         }
83         "-n" = "$snmp_interface$"
84         "-f" = {
85           set_if = "$snmp_perf$"
86         }
87         "-w" = "$snmp_warn$"
88         "-c" = "$snmp_crit$"
89       }
90
91       vars.snmp_v2 = true
92       vars.snmp_perf = true
93       vars.snmp_warn = "300,400"
94       vars.snmp_crit = "0,600"
95     }
96
97
98 For further information on your monitoring configuration read the
99 [Monitoring Basics](3-monitoring-basics.md#monitoring-basics) chapter.
100
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)
103
104 ### <a id="service-monitoring-plugin-api"></a> Plugin API
105
106 Currently Icinga 2 supports the native plugin API specification from the `Monitoring Plugins`
107 project.
108
109 The `Monitoring Plugin API` is defined in the [Monitoring Plugins Development Guidelines](https://www.monitoring-plugins.org/doc/guidelines.html).
110
111 ## <a id="service-monitoring-overview"></a> Service Monitoring Overview
112
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.
116
117 ## <a id="service-monitoring-general"></a> General Monitoring
118
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
123
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)
128
129 ## <a id="service-monitoring-linux"></a> Linux Monitoring
130
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))
137
138 ## <a id="service-monitoring-windows"></a> Windows Monitoring
139
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
144
145 ## <a id="service-monitoring-database"></a> Database Monitoring
146
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))
155
156 ## <a id="service-monitoring-snmp"></a> SNMP Monitoring
157
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)
160
161 ## <a id="service-monitoring-network"></a> Network Monitoring
162
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)
167
168 ## <a id="service-monitoring-web"></a> Web Monitoring
169
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)
178
179 ## <a id="service-monitoring-java"></a> Java Monitoring
180
181 * [jmx4perl](10-icinga-template-library.md#plugin-contrib-command-jmx4perl)
182
183 ## <a id="service-monitoring-dns"></a> DNS Monitoring
184
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)
188
189 ## <a id="service-monitoring-backup"></a> Backup Monitoring
190
191 * [check_bareos](https://github.com/widhalmt/check_bareos)
192
193 ## <a id="service-monitoring-log"></a> Log Monitoring
194
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)
198
199 ## <a id="service-monitoring-virtualization"></a> Virtualization Monitoring
200
201 * [esxi_hardware](10-icinga-template-library.md#plugin-contrib-command-esxi-hardware)
202 * [VMWare](10-icinga-template-library.md#plugin-contrib-vmware)
203
204 ## <a id="service-monitoring-sap"></a> SAP Monitoring
205
206 * [check_sap_health](https://labs.consol.de/nagios/check_sap_health/index.html)
207 * [SAP CCMS](https://sourceforge.net/projects/nagios-sap-ccms/)
208
209 ## <a id="service-monitoring-mail"></a> Mail Monitoring
210
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)
214
215 ## <a id="service-monitoring-hardware"></a> Hardware Monitoring
216
217 * [hpasm](10-icinga-template-library.md#plugin-contrib-command-hpasm)
218 * [ipmi-sensor](10-icinga-template-library.md#plugin-contrib-command-ipmi-sensor)
219
220 ## <a id="service-monitoring-metrics"></a> Metrics Monitoring
221
222 * [graphite](10-icinga-template-library.md#plugin-contrib-command-graphite)