-
Notifications
You must be signed in to change notification settings - Fork 30
/
scripts_for_nagios_icinga_alerts
83 lines (56 loc) · 2.17 KB
/
scripts_for_nagios_icinga_alerts
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
Scripts for alerts
RIPE Atlas functionality:
https://atlas.ripe.net/docs/api/v2/manual/measurements/status-checks.html
Examples of home-made scripts for using RIPE Atlas for automatic notifications using existing monitoring systems (nagios, icing and similar)
Wolfgang Nagele (note: edited for API v2 compatibility):
check_http -S -H atlas.ripe.net -j HEAD -d 'X-RIPE-Atlas-Global-Alert: 0' -u /api/v2/measurements/<MSM_ID>/status-check[?key=<api_key>]
& https://www.nagios-plugins.org/doc/man/check_http.html
Stephane Bortzmeyer
Here is what I use in Icinga (note: edited for API v2 compatibility):
define service {
use generic-service
host_name madiba
service_description Test_Atlas
check_command check_http!-H atlas.ripe.net -I atlas.ripe.net -r 'global_alert":false' --ssl=1 -u /api/v2/measurements/1963375/status-check?permitted_total_alerts=1
}
Michael Friedrich (note: edited for API v2 compatibility):
Modifed the example above for usage with Icinga 2
https://wiki.icinga.org/display/howtos/RIPE+Atlas+Monitoring
object CheckCommand "ripe-atlas" {
import "plugin-check-command"
command = [ PluginDir + "/check_http",
"-H", "$apiaddress$",
"-I", "$apiaddress$",
"-r", "$apiresult$",
"--ssl=1",
"-u", "/api/v$apiversion$/measurements/$measureid$/status-check?permitted_total_alerts=$critalerts$",
"-t", "$timeout$"
]
vars.apiaddress = "atlas.ripe.net"
vars.apiresult = "global_alert\":false"
vars.apiversion = "2"
vars.critalerts = "1"
vars.timeout = 30
}
object Host "RIPE Atlas" {
import "generic-host"
address = "atlas.ripe.net",
address6 = "2001:67c:2e8:22::c100:69e"
vars.measureid = "1040425"
}
object Host "RIPE Lab" {
import "generic-host"
address = "labs.ripe.net",
address6 = "2001:67c:2e8:22::c100:699"
//uncomment to apply service
//vars.measureid = "1040425"
}
apply Service "atlas" {
import "generic-service"
check_command = "ripe-atlas"
vars.apiresult = "global_alert\":false"
vars.critalerts = "1"
vars.measureid = "$host.vars.measureid$"
assign where match("RIPE*", host.name)
ignore where !host.vars.measureid
}