← Back to team overview

nagios-charmers team mailing list archive

[Merge] ~xavpaice/nagios-charm:pagerduty into nagios-charm:master

 

Xav Paice has proposed merging ~xavpaice/nagios-charm:pagerduty into nagios-charm:master.

Requested reviews:
  Nagios Charm developers (nagios-charmers)

For more details, see:
https://code.launchpad.net/~xavpaice/nagios-charm/+git/nagios-charm/+merge/352052
-- 
Your team Nagios Charm developers is requested to review the proposed merge of ~xavpaice/nagios-charm:pagerduty into nagios-charm:master.
diff --git a/config.yaml b/config.yaml
index 8dd857f..eca8add 100644
--- a/config.yaml
+++ b/config.yaml
@@ -170,3 +170,10 @@ options:
             A string to pass to the Nagios load monitoring command.  Default is
             to report warning at 5.0, 4.0 and 3.0 averages, critical at 10.0, 
             6.0 and 4.0.
+    pagerduty_notification_levels:
+        default: w,u,c,r
+        type: string
+        description: |
+            A string to use for the service_notification_options in the
+            pagerduty contact configuration.  Remove w to avoid paging for
+            warning events.
diff --git a/hooks/templates/pagerduty_nagios_cfg.tmpl b/hooks/templates/pagerduty_nagios_cfg.tmpl
index 155aae3..e5c8751 100644
--- a/hooks/templates/pagerduty_nagios_cfg.tmpl
+++ b/hooks/templates/pagerduty_nagios_cfg.tmpl
@@ -7,7 +7,7 @@ define contact {
        alias                                    PagerDuty Pseudo-Contact
        service_notification_period              24x7
        host_notification_period                 24x7
-       service_notification_options             w,u,c,r
+       service_notification_options             {{ notification_levels }}
        host_notification_options                d,r
        service_notification_commands            notify-service-by-pagerduty
        host_notification_commands               notify-host-by-pagerduty
diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm
index 88b6ecb..8349c36 100755
--- a/hooks/upgrade-charm
+++ b/hooks/upgrade-charm
@@ -26,6 +26,7 @@ livestatus_path = hookenv.config('livestatus_path')
 enable_pagerduty = hookenv.config('enable_pagerduty')
 pagerduty_key = hookenv.config('pagerduty_key')
 pagerduty_path = hookenv.config('pagerduty_path')
+notification_levels = hookenv.config('pagerduty_notification_levels')
 nagios_user = hookenv.config('nagios_user')
 nagios_group = hookenv.config('nagios_group')
 ssl_config = hookenv.config('ssl')
@@ -123,7 +124,8 @@ def enable_pagerduty_config():
         template_values = {'enable_pagerduty': enable_pagerduty,
                            'pagerduty_key': pagerduty_key,
                            'pagerduty_path': pagerduty_path,
-                           'proxy_switch': proxy_switch}
+                           'proxy_switch': proxy_switch,
+                           'notification_levels': notification_levels}
 
         with open('hooks/templates/pagerduty_nagios_cfg.tmpl', 'r') as f:
             templateDef = f.read()

Follow ups