Merge ~xavpaice/charm-nagios:pagerduty into ~nagios-charmers/charm-nagios:master

Proposed by Xav Paice
Status: Merged
Approved by: Barry Price
Approved revision: 7f69a734f50cc6f9e21e4936369c522210b126ff
Merged at revision: b128abd5648c4f8958e6e5a2dcd3fb9fb88ecd69
Proposed branch: ~xavpaice/charm-nagios:pagerduty
Merge into: ~nagios-charmers/charm-nagios:master
Diff against target: 50 lines (+11/-2)
3 files modified
config.yaml (+7/-0)
hooks/templates/pagerduty_nagios_cfg.tmpl (+1/-1)
hooks/upgrade-charm (+3/-1)
Reviewer Review Type Date Requested Status
Barry Price Approve
Review via email: mp+352052@code.launchpad.net

Commit message

new config option to change pagerduty alert levels

To post a comment you must log in.
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Barry Price (barryprice) wrote :

LGTM +1

review: Approve
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

Change successfully merged at revision b128abd5648c4f8958e6e5a2dcd3fb9fb88ecd69

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index 8dd857f..eca8add 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -170,3 +170,10 @@ options:
6 A string to pass to the Nagios load monitoring command. Default is
7 to report warning at 5.0, 4.0 and 3.0 averages, critical at 10.0,
8 6.0 and 4.0.
9+ pagerduty_notification_levels:
10+ default: w,u,c,r
11+ type: string
12+ description: |
13+ A string to use for the service_notification_options in the
14+ pagerduty contact configuration. Remove w to avoid paging for
15+ warning events.
16diff --git a/hooks/templates/pagerduty_nagios_cfg.tmpl b/hooks/templates/pagerduty_nagios_cfg.tmpl
17index 155aae3..e5c8751 100644
18--- a/hooks/templates/pagerduty_nagios_cfg.tmpl
19+++ b/hooks/templates/pagerduty_nagios_cfg.tmpl
20@@ -7,7 +7,7 @@ define contact {
21 alias PagerDuty Pseudo-Contact
22 service_notification_period 24x7
23 host_notification_period 24x7
24- service_notification_options w,u,c,r
25+ service_notification_options {{ notification_levels }}
26 host_notification_options d,r
27 service_notification_commands notify-service-by-pagerduty
28 host_notification_commands notify-host-by-pagerduty
29diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm
30index 88b6ecb..8349c36 100755
31--- a/hooks/upgrade-charm
32+++ b/hooks/upgrade-charm
33@@ -26,6 +26,7 @@ livestatus_path = hookenv.config('livestatus_path')
34 enable_pagerduty = hookenv.config('enable_pagerduty')
35 pagerduty_key = hookenv.config('pagerduty_key')
36 pagerduty_path = hookenv.config('pagerduty_path')
37+notification_levels = hookenv.config('pagerduty_notification_levels')
38 nagios_user = hookenv.config('nagios_user')
39 nagios_group = hookenv.config('nagios_group')
40 ssl_config = hookenv.config('ssl')
41@@ -123,7 +124,8 @@ def enable_pagerduty_config():
42 template_values = {'enable_pagerduty': enable_pagerduty,
43 'pagerduty_key': pagerduty_key,
44 'pagerduty_path': pagerduty_path,
45- 'proxy_switch': proxy_switch}
46+ 'proxy_switch': proxy_switch,
47+ 'notification_levels': notification_levels}
48
49 with open('hooks/templates/pagerduty_nagios_cfg.tmpl', 'r') as f:
50 templateDef = f.read()

Subscribers

People subscribed via source and target branches