]> granicus.if.org Git - icinga2/blob - doc/3.15-monitoring-remote-clients.md
Remove the 'Icinga' prefix for global constants.
[icinga2] / doc / 3.15-monitoring-remote-clients.md
1 ## <a id="monitoring-remote-clients"></a> Monitoring Remote Clients
2
3 ### Agent-less Checks
4
5 If the remote service is available using a network protocol and port,
6 and a [check plugin](#setting-up-check-plugins) is available, you don't
7 necessarily need a local client installed. Rather choose a plugin and
8 configure all parameters and thresholds. The [Icinga 2 Template Library](#itl)
9 already ships various examples.
10
11 ### Agent-based Checks
12
13 If the remote services are not directly accessible through the network, a
14 local agent installation exposing the results to check queries can
15 become handy.
16
17 #### SNMP
18
19 The SNMP daemon runs on the remote system and answers SNMP queries by plugin
20 binaries. The [Monitoring Plugins package](#setting-up-check-plugins) ships
21 the `check_snmp` plugin binary, but there are plenty of [existing plugins](#integrate-additional-plugins)
22 for specific use cases already around, for example monitoring Cisco routers.
23
24 The following example uses the [SNMP ITL](#itl-snmp) `CheckCommand` and just
25 overrides the `oid` custom attribute. A service is created for all hosts which
26 have the `community` custom attribute.
27
28     apply Service "uptime" {
29       import "generic-service"
30
31       templates = [ "generic-service" ]
32       check_command = "snmp"
33       vars.oid = "1.3.6.1.2.1.1.3.0"
34   
35       assign where host.vars.community
36     }
37
38 #### SSH
39
40 Calling a plugin using the SSH protocol to execute a plugin on the remote server fetching
41 its return code and output. `check_by_ssh` is available in the [Monitoring Plugins package](#setting-up-check-plugins).
42
43     object CheckCommand "check_by_ssh_swap" {
44       import "plugin-check-command"
45
46       command = [ PluginDir + "/check_by_ssh",
47                   "-l", "remoteuser",
48                   "-H", "$address$",
49                   "-C", "\"/usr/local/icinga/libexec/check_swap -w $warn$ -c $crit$\""
50                 ]
51     }
52
53     object Service "swap" {
54       import "generic-service"
55
56       host_name = "remote-ssh-host"
57
58       check_command = "check_by_ssh_swap"
59       vars = {
60             "warn" = "50%"
61             "crit" = "75%"
62       }
63     }
64
65 #### NRPE
66
67 [NRPE](http://docs.icinga.org/latest/en/nrpe.html) runs as daemon on the remote client including
68 the required plugins and command definitions.
69 Icinga 2 calls the `check_nrpe` plugin binary in order to query the configured command on the
70 remote client.
71
72 The NRPE daemon uses its own configuration format in nrpe.cfg while `check_nrpe`
73 can be embedded into the Icinga 2 `CheckCommand` configuration syntax.
74
75 Example:
76
77     object CheckCommand "check_nrpe" {
78       import "plugin-check-command"
79
80       command = [
81         PluginDir + "/check_nrpe",
82         "-H", "$address$",
83         "-c", "$remote_nrpe_command$",
84       ]
85     }
86
87     object Service "users" {
88       import "generic-service"
89   
90       host_name = "remote-nrpe-host"
91
92       check_command = "check_nrpe"
93       vars.remote_nrpe_command = "check_users"
94     }
95
96 nrpe.cfg:
97
98     command[check_users]=/usr/local/icinga/libexec/check_users -w 5 -c 10
99
100 #### NSClient++
101
102 [NSClient++](http://nsclient.org) works on both Windows and Linux platforms and is well
103 known for its magnificent Windows support. There are alternatives like the WMI interface,
104 but using `NSClient++` will allow you to run local scripts similar to check plugins fetching
105 the required output and performance counters.
106
107 The NSClient++ agent uses its own configuration format while `check_nt`
108 can be embedded into the Icinga 2 `CheckCommand` configuration syntax.
109
110 Example:
111
112     object CheckCommand "check_nscp" {
113       import "plugin-check-command"
114
115       command = [
116         PluginDir + "/check_nt",
117         "-H", "$address$",
118         "-p", "$port$",
119         "-v", "$remote_nscp_command$",
120         "-l", "$partition$",
121         "-w", "$warn$",
122         "-c", "$crit$",
123         "-s", "$pass$"
124       ]
125
126       vars = {
127         "port" = "12489"
128         "pass" = "supersecret"
129       }
130     }
131
132     object Service "users" {
133       import "generic-service"
134   
135       host_name = "remote-windows-host"
136
137       check_command = "check_nscp"
138
139       vars += {
140         remote_nscp_command = "USEDDISKSPACE"
141         partition = "c"
142         warn = "70"
143         crit = "80"
144       }
145     }
146
147 For details on the `NSClient++` configuration please refer to the [official documentation](http://www.nsclient.org/nscp/wiki/doc/configuration/0.4.x).
148
149 > **Note**
150
151 > The format of the `NSClient++` configuration file has changed from 0.3.x to 0.4!
152
153 #### Icinga 2 Agent
154
155 A dedicated Icinga 2 agent supporting all platforms and using the native
156 Icinga 2 communication protocol supported with SSL certificates, IPv4/IPv6
157 support, etc. is on the [development roadmap](https://dev.icinga.org/projects/i2?jump=issues).
158 Meanwhile remote checkers in a [Cluster](#cluster) setup could act as
159 immediate replacement, but without any local configuration - or pushing
160 their standalone configuration back to the master node including their check
161 result messages.
162
163 ### Passive Check Results and SNMP Traps
164
165 > **Note**
166 >
167 > The host and service object configuration must be available on the Icinga 2
168 > server in order to process passive check results.
169
170 #### NSCA-NG
171
172 [NSCA-ng](http://www.nsca-ng.org) provides a client-server pair that allows the
173 remote sender to push check results into the Icinga 2 `ExternalCommandListener`
174 feature.
175
176 The [Icinga 2 Vagrant Demo VM](#vagrant) ships a demo integration and further samples.
177
178 #### SNMP Traps
179
180 SNMP Traps can be received and filtered by using [SNMPTT](http://snmptt.sourceforge.net/) and specific trap handlers
181 passing the check results to Icinga 2.
182
183