Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
nagios-mattermost-webhook.sh
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
# 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://
If Host:
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$"
--hoststate "$HOSTSTATE$"
--hostoutput "$HOSTOUTPUT$"
--hostnotes "$HOSTNOTES$"
--notificationtype "$NOTIFICATIONTYPE$"
--serviceorhost host
--webhookusername
--webhookchannel '<#channel>' (must use single quotes or escape the #)
--webhookurl http://
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://
If Host:
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$"
--hoststate "$HOSTSTATE$"
--hostoutput "$HOSTOUTPUT$"
--hostnotes "$HOSTNOTES$"
--notificationtype "$NOTIFICATIONTYPE$"
--serviceorhost host
--webhookusername
--webhookchannel '<#channel>' (must use single quotes or escape the #)
--webhookurl http://
Reviews (0)
Be the first to review this listing!