A plugin for Nagios to enable notifications to Mattermost Open Source Chat.
Assuming you are using Nagios 4, the steps are:
-
Copy mattermost.py to /usr/local/nagios/libexec.
-
Create the notification command:
define command { command_name notify-service-by-mattermost command_line /usr/local/nagios/libexec/mattermost.py --url [URL] --channel [CHANNEL] --hostalias "$HOSTNAME$" --notificationtype "$NOTIFICATIONTYPE$" --servicedesc "$SERVICEDESC$" --servicestate "$SERVICESTATE$" --serviceoutput "$SERVICEOUTPUT$" } define command { command_name notify-host-by-mattermost command_line /usr/local/nagios/libexec/mattermost.py --url [URL] --channel [CHANNEL] --hostalias "$HOSTNAME$" --notificationtype "$NOTIFICATIONTYPE$" --hoststate "$HOSTSTATE$" --hostoutput "$HOSTOUTPUT$" }
-
Create the contact:
define contact { contact_name mattermost alias Mattermost 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-mattermost host_notification_commands notify-host-by-mattermost }
-
Add the contact to a contact group:
define contactgroup{ contactgroup_name network-admins alias Network Administrators members email, mattermost }