This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpagerduty-icinga2.conf
78 lines (70 loc) · 2.02 KB
/
pagerduty-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
73
74
75
76
77
78
object User "pagerduty" {
pager = "SERVICE_API_KEY_HERE"
groups = [ "icingaadmins" ]
display_name = "PagerDuty Notification User"
states = [ OK, Warning, Critical, Unknown, Up, Down ]
types = [ Problem, Acknowledgement, Recovery ]
}
object NotificationCommand "notify-service-by-pagerduty" {
import "plugin-notification-command"
command = [ "/usr/local/bin/pagerduty_icinga.pl" ]
arguments = {
"enqueue" = {
skip_key = true
order = 0
value = "enqueue"
}
"-f" = {
order = 1
value = "pd_nagios_object=service"
}
}
env = {
"ICINGA_CONTACTPAGER" = "$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$"
}
}
object NotificationCommand "notify-host-by-pagerduty" {
import "plugin-notification-command"
command = [ "/usr/local/bin/pagerduty_icinga.pl" ]
arguments = {
"enqueue" = {
skip_key = true
order = 0
value = "enqueue"
}
"-f" = {
order = 1
value = "pd_nagios_object=host"
}
}
env = {
"ICINGA_CONTACTPAGER" = "$user.pager$"
"ICINGA_NOTIFICATIONTYPE" = "$notification.type$"
"ICINGA_HOSTNAME" = "$host.name$"
"ICINGA_HOSTALIAS" = "$host.display_name$"
"ICINGA_HOSTSTATE" = "$host.state$"
"ICINGA_HOSTOUTPUT" = "$host.output$"
}
}
apply Notification "pagerduty-service" to Service {
command = "notify-service-by-pagerduty"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery ]
period = "24x7"
users = [ "pagerduty" ]
assign where service.vars.enable_pagerduty == true
}
apply Notification "pagerduty-host" to Host {
command = "notify-host-by-pagerduty"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery ]
period = "24x7"
users = [ "pagerduty" ]
assign where host.vars.enable_pagerduty == true
}