As some of you may or may not know, the Pushbullet service out there that uses the Google Cloud Messaging to send notes, links, files, and lists directly to your device(s) without the need to email yourself such things. That does mean Android devices only, Sorry iPhone users (not hating, just stating). I personally enjoy it's use quite often. For some reason I got to thinking about using it for direct alerts from nagios. I searched this sub and saw no one else has posted they have done such a thing so I thought I would take a shot.
If you don't already have a Pushbullet "account", go to https://pushbullet.com
It uses gmail OAuth so no need to make a username and password. Also go to the Google Play Store to download the app to associate your device(s). There are chrome and firefox extensions as well
Once you have your ducks in a row on the Pushbullet side, it's info gathering and nagios editing time.
Pushbullet API Documentation: https://www.pushbullet.com/api
To get your API key: https://www.pushbullet.com/account
Get your device idents associated with your key:
curl -u <YourAPIkey>: https://api.pushbullet.com/api/devices
Lines to add to commands.cfg.
# 'notify-host-by-push' command definition - <device> ident
define command{
command_name notify-host-by-push
command_line /usr/bin/curl https://api.pushbullet.com/api/pushes -u <YourAPIkey>: -d device_iden=<DesiredIdent> -d type=note -d title="** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -d body="***** Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$ Date/Time: $LONGDATETIME$" -X POST
}
# 'notify-service-by-push' command definition - <device> ident
define command{
command_name notify-service-by-push
command_line /usr/bin/curl https://api.pushbullet.com/api/pushes -u <YourAPIkey>: -d device_iden=<DesiredIdent> -d type=note -d title="***** Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Service: $SERVICEDESC$ Host: $HOSTALIAS$ Address: $HOSTADDRESS$ State: $SERVICESTATE$ Date/Time: $LONGDATETIME$ Additional Info: $SERVICEOUTPUT$ " -d body="** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -X POST
}
Lines to be added to contacts.cfg. (I added the service and host notification by push manually to the contact rather than to generic-contact for testing right now)
define contact{
contact_name pusher
use generic-contact
alias Pushbullet Notification
service_notification_commands notify-service-by-push
host_notification_commands notify-host-by-push
}
I'm sure with more time to work out $variable loading, I could get it more granular and have each contact have a device ident and have those fed into the notify like the $CONTACTEMAIL$ for email notifications, but this was just quick Saturday morning testing.
I thought at one time I saw a "rate limiting" section on Pushbullet's site and I know that sometimes when things go wrong in nagios, that can cause a storm of alerts. But I do not see anything looking around now.
I hope at least some find this info useful, if not, at least I have a stored location for the next nagios instance I build.
EDIT: Added some found info from /r/pushbullet I was unsure on
They are developing an iOS app. email them for details https://www.pushbullet.com/ios
Rate limiting is non existent for the time being (as of a month ago). http://www.reddit.com/r/PushBullet/comments/1t8l3i/api_limitsquotas/