blob: ce08657303165edd2a543f7330b343af9fce3abf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
apply Service "icinga" {
check_command = "icinga"
assign where host.name == NodeName
}
apply Service "icingadb" {
check_command = "icingadb"
assign where host.name == NodeName
}
apply Service "ssh" {
check_command = "ssh"
assign where host.vars.os in ["FreeBSD"," Linux"]
}
apply Service "upstream-packet-loss" {
check_command = "ping"
display_name = "upstream packet loss"
vars.ping_address = "${icinga_upstream_ping_address}"
vars.ping_wpl = ${icinga_upstream_packet_loss_warn}
vars.ping_cpl = ${icinga_upstream_packet_loss_crit}
vars.ping_wrta = ${icinga_upstream_latency_warn}
vars.ping_crta = ${icinga_upstream_latency_crit}
vars.ping_packets = ${icinga_upstream_packet_count}
assign where host.name == NodeName
}
apply Service "dns" {
check_command = "dns"
vars.dns_lookup = "\$address\$"
vars.dns_server = "\$address\$"
vars.dns_wtime = ${icinga_response_time_warn}
vars.dns_ctime = ${icinga_response_time_crit}
assign where "idm-servers" in host.groups
}
apply Service for (zone in host.vars.zones) {
check_command = "dns"
vars.dns_lookup = zone
name = "dns-" + zone
display_name = zone
vars.dns_server = "\$address\$"
vars.dns_wtime = ${icinga_response_time_warn}
vars.dns_ctime = ${icinga_response_time_crit}
assign where "nameservers" in host.groups
}
apply Service "resolver" {
check_command = "dns"
vars.dns_lookup = "www.google.com"
vars.dns_server = "\$address\$"
vars.dns_wtime = ${icinga_response_time_warn}
vars.dns_ctime = ${icinga_response_time_crit}
assign where "idm-servers" in host.groups
}
apply Service "ldap" {
check_command = "ldap"
vars.ldap_port = 389
vars.ldap_warning = ${icinga_response_time_warn}
vars.ldap_critical = ${icinga_response_time_crit}
vars.ldap_v2 = false
vars.ldap_v3 = true
vars.ldap_starttls = true
vars.ldap_bind = "${icinga_dn}"
vars.ldap_pass = IcingaPassword
vars.ldap_base = "${hosts_basedn}"
vars.ldap_attr = "(cn=" + NodeName + ")"
assign where "idm-servers" in host.groups
}
apply Service "ldaps" {
check_command = "ldap"
vars.ldap_port = 636
vars.ldap_warning = ${icinga_response_time_warn}
vars.ldap_critical = ${icinga_response_time_crit}
vars.ldap_v2 = false
vars.ldap_v3 = true
vars.ldap_ssl = true
vars.ldap_bind = "${icinga_dn}"
vars.ldap_pass = IcingaPassword
vars.ldap_base = "${hosts_basedn}"
vars.ldap_attr = "(cn=" + NodeName + ")"
assign where "idm-servers" in host.groups
}
apply Service "imap" {
check_command = "imap"
vars.imap_port = 993
vars.imap_ssl = true
vars.imap_certificate_age = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
vars.imap_warning = ${icinga_response_time_warn}
vars.imap_critical = ${icinga_response_time_crit}
assign where "imap-servers" in host.groups
}
apply Service "lmtp" {
check_command = "smtp2"
vars.smtp_port = 25
vars.smtp_starttls = true
vars.smtp_lmtp = true
vars.smtp_mail_from = "${icinga_smtp_mail_from}"
vars.smtp_command = "RCPT TO:<" + "${icinga_lmtp_rcpt_to}" + ">"
vars.smtp_response = "250 2.1.5 OK"
assign where "imap-servers" in host.groups
}
apply Service "lmtp-cert" {
display_name = "lmtp certificate"
check_command = "smtp2"
vars.smtp_lmtp = true
vars.smtp_port = 25
vars.smtp_certificate_age = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
vars.smtp_starttls = true
assign where "imap-servers" in host.groups
}
apply Service "smtp" {
check_command = "smtp"
vars.smtp_port = 25
vars.smtp_starttls = true
vars.smtp_warning = ${icinga_response_time_warn}
vars.smtp_critical = ${icinga_response_time_crit}
vars.smtp_mail_from = "${icinga_smtp_mail_from}"
vars.smtp_command = "RCPT TO:<" + "${icinga_smtp_rcpt_to}" + ">"
vars.smtp_response = "250 2.1.5 Ok"
assign where "smtp-servers" in host.groups
}
apply Service "smtp-cert" {
display_name = "smtp certificate"
check_command = "smtp"
vars.smtp_port = 25
vars.smtp_certificate_age = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
vars.smtp_starttls = true
assign where "smtp-servers" in host.groups
}
apply Service "submission" {
check_command = "smtp"
vars.smtp_port = 587
vars.smtp_certificate_age = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
vars.smtp_starttls = true
vars.smtp_warning = ${icinga_response_time_warn}
vars.smtp_critical = ${icinga_response_time_crit}
assign where "smtp-servers" in host.groups
}
apply Service "mailq" {
check_command = "mailq_by_ssh"
vars.mailq_servertype = "postfix"
vars.mailq_warning = ${icinga_mailq_warn}
vars.mailq_critical = ${icinga_mailq_crit}
assign where "smtp-servers" in host.groups
}
apply Service "postgres" {
check_command = "pgsql"
vars.pgsql_warning = ${icinga_response_time_warn}
vars.pgsql_critical = ${icinga_response_time_crit}
vars.pgsql_username = "${icinga_username}"
vars.pgsql_password = IcingaPassword
vars.pgsql_options = ["sslmode=verify-full", "sslrootcert=system"]
assign where "postgresql-servers" in host.groups
}
apply Service "eap-cert" {
check_command = "eapol"
vars.eapol_secret = IcingaRadiusSecret
vars.eapol_config_file = "${icinga_home_dir}/eap-tls.conf"
assign where "radius-servers" in host.groups
}
apply Service "eap-ttls-pap" {
check_command = "eapol"
vars.eapol_secret = IcingaRadiusSecret
vars.eapol_config_file = "${icinga_home_dir}/eap-ttls-pap.conf"
assign where "radius-servers" in host.groups
}
apply Service "irc" {
check_command = "tcp"
vars.tcp_port = 6697
vars.tcp_ssl = true
vars.tcp_certificate = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
vars.tcp_wtime = ${icinga_response_time_warn}
vars.tcp_ctime = ${icinga_response_time_crit}
assign where "znc-servers" in host.groups
}
apply Service "turn" {
check_command = "tcp"
vars.tcp_port = 3478
vars.tcp_wtime = ${icinga_response_time_warn}
vars.tcp_ctime = ${icinga_response_time_crit}
assign where "turn-servers" in host.groups
}
apply Service "cups" {
check_command = "http"
display_name = "cups status"
vars.http_vhost = "\$address\$"
vars.http_port = 631
vars.http_expect = "HTTP/1.1 200 OK"
vars.http_ssl = true
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("cups-servers" in host.groups)
}
apply Service "cups-cert" {
check_command = "http"
display_name = "cups certificate"
vars.http_vhost = "\$address\$"
vars.http_port = 631
vars.http_ssl = true
vars.http_certificate = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
assign where ("cups-servers" in host.groups)
}
apply Service for (vhost in host.vars.xmpp_vhosts) {
check_command = "tcp"
name = vhost + "-xmpp"
display_name = vhost + " xmpp"
vars.tcp_port = 5223
vars.tcp_ssl = true
vars.tcp_sni = vhost
vars.tcp_certificate = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
vars.tcp_wtime = ${icinga_response_time_warn}
vars.tcp_ctime = ${icinga_response_time_crit}
vars.tcp_send = "<stream:stream to='" + vhost + "' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>"
vars.tcp_expect = "<?xml version='1.0'"
}
// Expect HTTP 200
apply Service "http" {
check_command = "http"
display_name = "http status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 200 OK"
vars.http_ssl = false
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("pkg-repositories" in host.groups)
}
// Expect HTTP 301
apply Service "http" {
check_command = "http"
display_name = "http status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 301 Moved Permanently"
vars.http_ssl = false
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("dav-servers" in host.groups
|| "smtp-servers" in host.groups
|| "ttrss-servers" in host.groups
|| "invidious-servers" in host.groups
|| "nfs-servers" in host.groups
|| "web-servers" in host.groups
|| "xmpp-servers" in host.groups
|| "znc-servers" in host.groups
|| "icinga-servers" in host.groups
|| "bitwarden-servers" in host.groups
|| "git-servers" in host.groups)
}
// Expect HTTP 302
apply Service "http" {
check_command = "http"
display_name = "http status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 302"
vars.http_ssl = false
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("unifi-controllers" in host.groups)
}
// Expect HTTPS 401
apply Service "https" {
check_command = "http"
display_name = "https status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 401 Unauthorized"
vars.http_ssl = true
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("dav-servers" in host.groups
|| "smtp-servers" in host.groups
|| "icinga-servers" in host.groups
|| "ttrss-servers" in host.groups)
}
// Expect HTTPS 200
apply Service "https" {
check_command = "http"
display_name = "https status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 200 OK"
vars.http_ssl = true
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("pkg-repositories" in host.groups
|| "znc-servers" in host.groups
|| "bitwarden-servers" in host.groups
|| "git-servers" in host.groups)
}
// Expect HTTPS 404
apply Service "https" {
check_command = "http"
display_name = "https status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 404 Not Found"
vars.http_ssl = true
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("nfs-servers" in host.groups)
}
// Expect HTTPS 302
apply Service "https" {
check_command = "http"
display_name = "https status"
vars.http_vhost = "\$address\$"
vars.http_expect = "HTTP/1.1 302"
vars.http_ssl = true
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
assign where ("unifi-controllers" in host.groups
|| "invidious-servers" in host.groups)
}
// Certificate validity
apply Service "https-cert" {
check_command = "http"
display_name = "https certificate"
vars.http_vhost = "\$address\$"
vars.http_ssl = true
vars.http_certificate = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
assign where (("invidious-servers" in host.groups
|| "nfs-servers" in host.groups
|| "pkg-repositories" in host.groups
|| "unifi-controllers" in host.groups
|| "web-servers" in host.groups
|| "znc-servers" in host.groups
|| "bitwarden-servers" in host.groups
|| "dav-servers" in host.groups
|| "smtp-servers" in host.groups
|| "icinga-servers" in host.groups
|| "web-servers" in host.groups
|| "ttrss-servers" in host.groups
|| "git-servers" in host.groups)
&& !host.vars.https_vhosts)
}
// Certificate validity
apply Service for (vhost in host.vars.https_vhosts) {
check_command = "http"
name = vhost + "-https-cert"
display_name = vhost + " https certificate"
vars.http_vhost = vhost
vars.http_expect = "HTTP/1.1 200 OK"
vars.http_ssl = true
vars.http_sni = true
vars.http_certificate = ${icinga_cert_days_warn} + "," + ${icinga_cert_days_crit}
}
// Expect HTTPS 200
apply Service for (vhost in host.vars.https_vhosts) {
check_command = "http"
name = vhost + "-https-status"
display_name = vhost + " https status"
vars.http_vhost = vhost
vars.http_ssl = true
vars.http_sni = true
vars.http_expect = "HTTP/1.1 200 OK"
vars.http_warn_time = ${icinga_response_time_warn}
vars.http_critical_time = ${icinga_response_time_crit}
}
|