Nagios PushOver Integration

Aleksandr Rain
2 min readNov 3, 2015

--

Recently I discovered a great little app called PushOver. This app allows me to receive push notifications on my iOS devices or Mac (it also works for Windows and Android platforms as well, but really who wants to use those) from any service that utilizes the PushOver API such as IFTTT. As it turns out, you can very easily integrate PushOver into Nagios as well utilizing a script called notify_by_pushover.sh created by Jedda Wignall (@jedda) . And that is what we did.

It starts with getting the PushOver app installed on your device. It’s a few bucks, but seriously, the coolness of getting this to work is worth it.

Next, you’ll need to grab Jedda’s script from GitHub and put it somewhere on your Nagios server.

You’ll then need to configure Nagios to utilize this script for notifcations. So in the commands.cfg, where you have notify-host-by-email and notify-service-by-email commands, also add PushOver commands. They should probably look similar to:

# 'notify-host-pushover' command definition
define command{
command_name notify-host-pushover
command_line /usr/lib64/nagios/plugins/notify_by_pushover.sh -u $CONTACTADDRESS1$ -a $CONTACTADDRESS2$ -c 'persistent' -w 'siren' -t "Nagios" -m "$NOTIFICATIONTYPE$ Host $HOSTNAME$ $HOSTSTATE$"
}

# 'notify-service-pushover' command definition
define command{
command_name notify-service-pushover
command_line /usr/lib64/nagios/plugins/notify_by_pushover.sh -u $CONTACTADDRESS1$ -a $CONTACTADDRESS2$ -c 'persistent' -w 'siren' -t "Nagios" -m "$HOSTNAME$ $SERVICEDESC$ : $SERVICESTATE$ Additional info: $SERVICEOUTPUT$"
}

Since we still wanted to receive Nagios alert emails in addition to PushOver alerts, it was necessary to define a new PushOver Contact Template:

define contact{
name generic-pushover
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u
service_notification_options c,u
host_notification_commands notify-host-pushover
service_notification_commands notify-service-pushover
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
register 0
}

This enabled us to create new contacts to send the PushOver notifications to.

define contact{
use generic-pushover
contact_name alek_pushover
alias Alek Pushover
contactgroups smartalek_ops
address1 {{ pushover_user_key_goes_here }}
address2 {{ pushover_application_api_key }}
}

Thats it. Just restart Nagios and you should be good to go.

Originally published at https://smartaleksolutions.com on November 3, 2015.

--

--

Aleksandr Rain
0 Followers

Climber, surfer, yogi, dad who does some IT on the side to get by.