-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsquadcast-icinga2.conf
72 lines (66 loc) · 2.63 KB
/
squadcast-icinga2.conf
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
object User "squadcast" {
pager = "<SQUADCAST_ICINGA2_WEBHOOK_URL>"
groups = [ "icingaadmins" ]
display_name = "Squadcast Notification User"
states = [ OK, Warning, Critical, Unknown, Up, Down ]
types = [ Problem, Acknowledgement, Recovery ]
}
object NotificationCommand "sq-icinga2-service" {
import "plugin-notification-command"
command = [ "/etc/icinga2/scripts/sq-icinga2.py" ]
env = {
"ICINGA_CONTACT_WEBHOOK" = "$user.pager$"
"ICINGA_NOTIFICATIONTYPE" = "$notification.type$"
"ICINGA_SERVICEDESC" = "$service.name$"
"ICINGA_HOSTNAME" = "$host.name$"
"ICINGA_HOSTALIAS" = "$host.display_name$"
"ICINGA_SERVICESTATE" = "$service.state$"
"ICINGA_SERVICEOUTPUT" = "$service.output$"
"ICINGA_ALERTSOURCE" = "SERVICE"
"ICINGA_DOWNTIMEDEPTH" = "$service.downtime_depth$"
"ICINGA_SERVICEDURATIONSEC" = "$service.duration_sec$"
"ICINGA_COMMENT" = "$notification.comment$"
"ICINGA_SERVICELATENCY" = "$service.latency$"
"ICINGA_SERVICEEXECUTIONTIME" = "$service.execution_time$"
}
}
object NotificationCommand "sq-icinga2-host" {
import "plugin-notification-command"
command = [ "/etc/icinga2/scripts/sq-icinga2.py" ]
env = {
"ICINGA_CONTACT_WEBHOOK" = "$user.pager$"
"ICINGA_NOTIFICATIONTYPE" = "$notification.type$"
"ICINGA_HOSTNAME" = "$host.name$"
"ICINGA_HOSTALIAS" = "$host.display_name$"
"ICINGA_HOSTSTATE" = "$host.state$"
"ICINGA_HOSTOUTPUT" = "$host.output$"
"ICINGA_ALERTSOURCE" = "HOST"
"ICINGA_NUMSERVICESOK" = "$host.num_services_ok$"
"ICINGA_NUMSERVICESWARNING" = "$host.num_services_warning$"
"ICINGA_NUMSERVICESUNKNOWN" = "$host.num_services_unknown$"
"ICINGA_NUMSERVICESCRITICAL" = "$host.num_services_critical$"
"ICINGA_COMMENT" = "$notification.comment$"
"ICINGA_HOSTNUMSERVICESOK" = "$host.num_services_ok$"
"ICINGA_HOSTNUMSERVICESWARNING" = "$host.num_services_warning$"
"ICINGA_HOSTNUMSERVICESUNKNOWN" = "$host.num_services_unknown$"
"ICINGA_HOSTNUMSERVICESCRITICAL" = "$host.num_services_critical$"
"ICINGA_HOSTEXECUTIONTIME" = "$host.execution_time$"
"ICINGA_HOSTLATENCY" = "$host.latency$"
}
}
apply Notification "squadcast-service" to Service {
command = "sq-icinga2-service"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery ]
period = "24x7"
users = [ "squadcast" ]
assign where service.vars.enable_squadcast == true
}
apply Notification "squadcast-host" to Host {
command = "sq-icinga2-host"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery ]
period = "24x7"
users = [ "squadcast" ]
assign where host.vars.enable_squadcast == true
}