diff --git a/nagios/files/commands.cfg b/nagios/files/commands.cfg index 295f044..1bccc61 100644 --- a/nagios/files/commands.cfg +++ b/nagios/files/commands.cfg @@ -245,3 +245,12 @@ define command{ } +define command{ + command_name notify-host-by-prowl + command_line /usr/bin/curl -s -o /dev/null -F apikey="$CONTACTADDRESS1$" -F application="Nagios" -F event="Host Alert" -F description="$HOSTNAME$ $HOSTDESC$ '$HOSTOUTPUT$'" "https://prowl.weks.net/publicapi/add" +} + +define command{ + command_name notify-service-by-prowl + command_line /usr/bin/curl -s -o /dev/null -F apikey="$CONTACTADDRESS1$" -F application="Nagios" -F event="Service Alert" -F description="$HOSTNAME$ $SERVICEDESC$ '$SERVICEOUTPUT$'" "https://prowl.weks.net/publicapi/add" +} diff --git a/nagios/manifests/init.pp b/nagios/manifests/init.pp index 6117052..01740c7 100644 --- a/nagios/manifests/init.pp +++ b/nagios/manifests/init.pp @@ -243,6 +243,30 @@ define nagios::contact::email($confdir=$nagios::server::confdir) { } +define nagios::contact::prowl($confdir=$nagios::server::confdir) { + + file { "${confdir}/contact_${name}.cfg": + ensure => present, + mode => "0644", + owner => "root", + group => "root", + before => Nagios_Contact[$name], + } + nagios_contact { $name: + target => "${confdir}/contact_${name}.cfg", + host_notification_commands => "notify-host-by-prowl", + host_notification_options => "d,r", + host_notification_period => "24x7", + service_notification_commands => "notify-service-by-prowl", + service_notification_options => "w,u,c,r", + service_notification_period => "24x7", + address1 => $name, + notify => Service["nagios"], + } + +} + + define nagios::host($confdir, $operatingsystem) { file { "${confdir}/host_${name}.cfg":