Skip to content

Instantly share code, notes, and snippets.

@erincerys
Created May 18, 2015 18:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erincerys/b5cf92776e46e556dadf to your computer and use it in GitHub Desktop.
Save erincerys/b5cf92776e46e556dadf to your computer and use it in GitHub Desktop.
nagios3 notifier for pushbullet integration
# I've only included the two command additions to the this commands.cfg file
# 'notify-host-by-push' command definition
define command{
command_name notify-host-by-push
command_line /usr/bin/curl --header 'Authorization: Bearer <your_access_token_here>' -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "* $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **", "body": "***** Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$ Date/Time: $LONGDATETIME$", "email": "<email_associated_with@pushbullet-account.here>"}'
}
# 'notify-service-by-push' command definition - ident
define command{
command_name notify-service-by-push
command_line /usr/bin/curl --header 'Authorization: Bearer <your_access_token_here>' -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **", "body": "***** Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Service: $SERVICEDESC$ Host: $HOSTALIAS$ Address: $HOSTADDRESS$ State: $SERVICESTATE$ Date/Time: $LONGDATETIME$ Additional Info: $SERVICEOUTPUT$", "<email_associated_with@pushbullet-account.here>"}'
}
# Make sure your 'generic-service' template or any services or hosts your set up are assigned to the root contact, or whatever other contact you decide to use notify-service/host-by-push as the notification method for
define contact{
contact_name root
alias Root
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-push
host_notification_commands notify-host-by-push
# email root@localhost
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members root
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment