Puppet Class: nagios::server::notification::pagerduty
- Defined in:
- manifests/server/notification/pagerduty.pp
Overview
Class: nagios::server::notification::pagerduty
This will set up notification commands and plugin for performing pagerduty notifications. It will also build contacts with some simple defaults suitable for pagerduty. It requires you to have already set up the apt repositories from www.pagerduty.com/docs/guides/agent-install-guide/
Parameters
- pager
-
The pager to send messages to. Required.
- contacts
-
A hash of contacts to build, that will build with some suitable defaults for pagerduty - these can be overriden. Not required.
Authors
Ben Field <ben.field@concreteplatform.com>
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 |
# File 'manifests/server/notification/pagerduty.pp', line 22
class nagios::server::notification::pagerduty ($pager, $contacts = undef) {
include nagios::server::service
package { 'pdagent': ensure => installed, }
package { 'pdagent-integrations': ensure => installed, }
nagios_command { 'notify_service_by_pagerduty':
command_line => '/usr/share/pdagent-integrations/bin/pd-nagios -n service -k $CONTACTPAGER$ -t "$NOTIFICATIONTYPE$" -f SERVICEDESC="$SERVICEDESC$" -f SERVICESTATE="$SERVICESTATE$" -f HOSTNAME="$HOSTNAME$" -f SERVICEOUTPUT="$SERVICEOUTPUT$"',
target => '/etc/nagios3/conf.d/puppet/command_pagerduty.cfg',
notify => Exec['rechmod'],
}
nagios_command { 'notify_host_by_pagerduty':
command_line => '/usr/share/pdagent-integrations/bin/pd-nagios -n host -k $CONTACTPAGER$ -t "$NOTIFICATIONTYPE$" -f HOSTNAME="$HOSTNAME$" -f HOSTSTATE="$HOSTSTATE$"',
target => '/etc/nagios3/conf.d/puppet/command_pagerduty.cfg',
notify => Exec['rechmod'],
}
$defaults = {
ensure => present,
service_notification_commands => 'notify_service_by_pagerduty',
service_notification_period => '24x7',
service_notification_options => 'c,r',
host_notification_commands => 'notify_host_by_pagerduty',
host_notification_period => '24x7',
host_notification_options => 'd,r',
pager => $pager,
target => '/etc/nagios3/conf.d/puppet/contact_pagerduty.cfg',
notify => Exec['rechmod'],
}
if $contacts != undef {
create_resources('nagios_contact', $contacts, $defaults)
}
}
|