I was looking into using Pushbullet to notify me of the Nagios events, instead of sending the notifications via email. I stumbled upon this reddit post by a user named 1lowlyadmin which perfectly describes the process, but is around two years old and still uses the older Pushbullet API.

If you don’t know what Pushbullet is, here is a link to their site. They have clients for Android and iOS mobile devices, for Chrome, Firefox and Opera browsers, and a native client for Windows OS.

Pushbullet docs: https://docs.pushbullet.com/

There are two ways to get IDs for your devices, first is as described in the reddit post with curl:

The second is to go to https://www.pushbullet.com/#devices and click the device, and the last string in the url is the device ID.

The lines to add to commands.cfg (using the new Pushbullet v2 API):

# 'notify-host-by-push' command definition - ident define command{ command_name notify-host-by-push command_line /usr/bin/curl --header 'Access-Token: ' --header 'Content-Type: application/json' --data-binary '{"body":"***** Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$ Date/Time: $LONGDATETIME$","title":"** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ ","type":"note","device_iden":""}' --request POST https://api.pushbullet.com/v2/pushes } # 'notify-service-by-push' command definition - ident define command{ command_name notify-service-by-push command_line /usr/bin/curl --header 'Access-Token: ' --header 'Content-Type: application/json' --data-binary '{"body":" $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ","title":"*** Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Service: $SERVICEDESC$ Host: $HOSTALIAS$ Address: $HOSTADDRESS$ State: $SERVICESTATE$ Date/Time: $LONGDATETIME$ Additional Info: $SERVICEOUTPUT$ ","type":"note","device_iden":""}' --request POST https://api.pushbullet.com/v2/pushes }

Replace

You can also publish this to a Pushbullet channel, so that other people can subscribe to these notifications, such as your coworkers. In that case you have to create a channel and obtain the channel tag, and then replace device_iden with channel_tag. Keep in mind that the APIkey used to push the notifications to a channel needs to be of the channel owner.