Name: rocketchat-nagios
Owner: Rocket.Chat
Description: Sends Nagios notifications to Rocket.Chat, an Open Source Slack Alternative
Forked from: andrefreitas/rocketchat-nagios
Created: 2016-02-10 20:18:58.0
Updated: 2017-11-21 23:25:30.0
Pushed: 2016-02-09 22:34:53.0
Homepage: null
Size: 34
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Send notifications to a Rocketchat channel from Nagios.
Assuming you are using Nagios 4, the steps are:
Copy rocketchat.py to /usr/local/nagios/libexec.
Create the notification command (replace WEBHOOK_URL):
define command {
command_name notify-service-by-rocketchat
command_line /usr/local/nagios/libexec/rocketchat.py --url WEBHOOK_URL --hostalias "$HOSTNAME$" --notificationtype "$NOTIFICATIONTYPE$" --servicedesc "$SERVICEDESC$" --servicestate "$SERVICESTATE$" --serviceoutput "$SERVICEOUTPUT$"
}
define command {
command_name notify-host-by-rocketchat
command_line /usr/local/nagios/libexec/rocketchat.py --url WEBHOOK_URL --hostalias "$HOSTNAME$" --notificationtype "$NOTIFICATIONTYPE$" --hoststate "$HOSTSTATE$" --hostoutput "$HOSTOUTPUT$"
}
Create the contact:
define contact {
contact_name rocketchat
alias Rocketchat
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-rocketchat
host_notification_commands notify-host-by-rocketchat
}
Add the contact to a contact group:
define contactgroup{
contactgroup_name network-admins
alias Network Administrators
members email, rocketchat
}
Launch a development instance of Rocket with Docker:
docker-compose up
Create a new user and channel by accessing Rocket Chat in your browser.
Create a new channel called nagios.
Create a new incoming webhook integration for that channel.
Create a file url.txt with the complete url of the webhook:
http://192.168.99.100:32769/hooks/jyfgPbsat6cKYxXWS/rocket.cat/O1%2B5u6L2OzvJJYyH6wcfEYifcbbUvoOVsP37Zd%2Fc3b0%3D
Test a notification:
make test-ok test-critical test-unknown test-warning