Utilities

nagios-mattermost-webhook.sh

Description:

The goal of this mattermost/slack webhook integration is to make alerts more customizable and prettier. One of my complaints with the existing slack Nagios integration was the limited number of variables I could pass to slack. Also, I wanted links to the alert and to nagios in each alert. All of this is accomplished in this webhook integration.

Current Version

1.0.0

Last Release Date

2017-07-24

Compatible With

  • Nagios 4.x

Owner

License

GPL


Project Files
Project Photos
Project Notes
# Description The goal of this mattermost/slack webhook integration is to make alerts more customizable and prettier. One of my complaints with the existing slack Nagios integration was the limited number of variables I could pass to slack. Also, I wanted links to the alert and to nagios in each alert. All of this is accomplished in this webhook integration. ### Example alerts ![Alerts](http://i.imgur.com/6QI85mg.png) # Installation * I'm assuming that you already have a good understanding of how nagios works, that won't be covered here. * Copy the .sh to wherever your nagios plugins live. Typically `/usr/local/nagios/libexec/` (if you've compiled from source). * Set up the command like the examples below. ## Command Definitions define command { command_name notify_service command_line $USER1$/nagios-mattermost-webhook.sh --nagioshost $(echo $HOSTNAME) --hostalias "$HOSTNAME$" --servicedesc "$SERVICEDESC$" --servicestate "$SERVICESTATE$" --serviceoutput "$SERVICEOUTPUT$" --servicenotes "$SERVICENOTES$" --notificationtype "$NOTIFICATIONTYPE$" --serviceorhost service --webhookusername Nagios --webhookchannel '#alerts' --webhookurl 'https://mattermost.example.org/hooks/xxxxxxxxxxxxxxxxxxx' } define command { command_name notify_host command_line $USER1$/nagios-mattermost-webhook.sh --nagioshost $(echo $HOSTNAME) --hostalias "$HOSTNAME$" --hoststate "$HOSTSTATE$" --hostoutput "$HOSTOUTPUT$" --hostnotes "$HOSTNOTES$" --notificationtype "$NOTIFICATIONTYPE$" --serviceorhost host --webhookusername Nagios --webhookchannel '#alerts' --webhookurl 'https://mattermost.example/hooks/xxxxxxxxxxxxxxxxxxx' } ## Usage from terminal output If service: nagios-mattermost-webhook.sh --nagioshost $(echo $HOSTNAME) (used to build the nagios link URLs. Must be your ngios host fqdn. Ex. nagios.example.com) --hostalias "$HOSTNAME$" --servicedesc "$SERVICEDESC$" --servicestate "$SERVICESTATE$" --serviceoutput "$SERVICEOUTPUT$" --servicenotes "$SERVICENOTES$" --notificationtype "$NOTIFICATIONTYPE$" --serviceorhost service --webhookusername --webhookchannel '<#channel>' (must use single quotes or escape the #) --webhookurl http:// --webhookchannel '<#channel>' (must use single quotes or escape the #) --webhookurl http://
Reviews (0) Add a Review
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
0 (0)
Favorites
0
Views
10,759