nagios: Added support for Pushover notifications
This commit is contained in:
parent
c8a2ff7436
commit
313d847e6a
2 changed files with 59 additions and 4 deletions
|
@ -259,6 +259,20 @@ define command{
|
|||
}
|
||||
|
||||
|
||||
# 'notify-host-by-pushover' command definition
|
||||
define command{
|
||||
command_name notify-host-by-pushover
|
||||
command_line /usr/bin/curl -s -o /dev/null -F user="$CONTACTADDRESS1$" -F token="$CONTACTADDRESS2$" -F title="Nagios $NOTIFICATIONTYPE$ Host Alert" -F message="$HOSTNAME$ is $HOSTSTATE$ '$HOSTOUTPUT$'" "https://api.pushover.net/1/messages.json"
|
||||
}
|
||||
|
||||
|
||||
# 'notify-service-by-pushover' command definition
|
||||
define command{
|
||||
command_name notify-service-by-pushover
|
||||
command_line /usr/bin/curl -s -o /dev/null -F user="$CONTACTADDRESS1$" -F token="$CONTACTADDRESS2$" -F title="Nagios $NOTIFICATIONTYPE$ Service Alert" -F message="$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ '$SERVICEOUTPUT$'" "https://api.pushover.net/1/messages.json"
|
||||
}
|
||||
|
||||
|
||||
# 'check_esxi_hardware' command definition
|
||||
define command{
|
||||
command_name check_esxi_hardware
|
||||
|
|
|
@ -341,16 +341,16 @@ define nagios::contact::prowl($group=["all"],
|
|||
|
||||
$contactgroups = inline_template('<%= group.join(",") -%>')
|
||||
|
||||
file { "${confdir}/contact_${name}.cfg":
|
||||
file { "${confdir}/contact_prowl_${name}.cfg":
|
||||
ensure => present,
|
||||
mode => "0640",
|
||||
owner => "root",
|
||||
group => "nagios",
|
||||
before => Nagios_Contact[$name],
|
||||
before => Nagios_Contact["prowl-${name}"],
|
||||
require => File["/etc/nagios/conf.d"],
|
||||
}
|
||||
nagios_contact { $name:
|
||||
target => "${confdir}/contact_${name}.cfg",
|
||||
nagios_contact { "prowl-${name}":
|
||||
target => "${confdir}/contact_prowl_${name}.cfg",
|
||||
contactgroups => $contactgroups,
|
||||
host_notification_commands => "notify-host-by-prowl",
|
||||
host_notification_options => "d,r",
|
||||
|
@ -365,6 +365,47 @@ define nagios::contact::prowl($group=["all"],
|
|||
}
|
||||
|
||||
|
||||
# Define nagios pushover contact.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Pushover user key.
|
||||
# $token:
|
||||
# Pushover application token.
|
||||
# $group:
|
||||
# List of contact groups. Defaults to "all".
|
||||
#
|
||||
define nagios::contact::pushover($token, $group=["all"],
|
||||
$confdir=$nagios::common::confdir) {
|
||||
|
||||
$contactgroups = inline_template('<%= group.join(",") -%>')
|
||||
|
||||
file { "${confdir}/contact_pushover_${name}.cfg":
|
||||
ensure => present,
|
||||
mode => "0640",
|
||||
owner => "root",
|
||||
group => "nagios",
|
||||
before => Nagios_Contact["pushover-${name}"],
|
||||
require => File["/etc/nagios/conf.d"],
|
||||
}
|
||||
nagios_contact { "pushover-${name}":
|
||||
target => "${confdir}/contact_pushover_${name}.cfg",
|
||||
contactgroups => $contactgroups,
|
||||
host_notification_commands => "notify-host-by-pushover",
|
||||
host_notification_options => "d,r",
|
||||
host_notification_period => "24x7",
|
||||
service_notification_commands => "notify-service-by-pushover",
|
||||
service_notification_options => "w,u,c,r",
|
||||
service_notification_period => "24x7",
|
||||
address1 => $name,
|
||||
address2 => $token,
|
||||
notify => Service["nagios"],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Define nagios target host.
|
||||
#
|
||||
# === Parameters
|
||||
|
|
Loading…
Add table
Reference in a new issue