How to edit the slack notification alerts
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
How to edit the slack notification alerts
we have integrated the nagios with the slack and as of now we are getting the alerts in slack like below:
============================
Host ‘hostname’ is DOWN:
CRITICAL - x.x.x.x: rta nan, lost 100%
================================
we would like to edit the alerts so that we can have the hostname followed by the hostgroupname like below:
=============================
Host ‘hostname’ - 'hostgroupname' is DOWN:
CRITICAL - x.x.x.x: rta nan, lost 100%
======================================
Commands used for notify-host-by-slack :
notify-host-by-slack $USER1$/slack_nagios.pl -field slack_channel="$CONTACTPAGER$" -field -field HOSTALIAS="$HOSTNAME$" -field NOTES="$HOSTNOTES$" -field HOSTSTATE="$HOSTSTATE$" -field HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
notify-service-by-slack :
notify-service-by-slack $USER1$/slack_nagios.pl -field slack_channel="$CONTACTPAGER$" -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
===============================================================
contact used for slack integration has the settings proper.
============================
Host ‘hostname’ is DOWN:
CRITICAL - x.x.x.x: rta nan, lost 100%
================================
we would like to edit the alerts so that we can have the hostname followed by the hostgroupname like below:
=============================
Host ‘hostname’ - 'hostgroupname' is DOWN:
CRITICAL - x.x.x.x: rta nan, lost 100%
======================================
Commands used for notify-host-by-slack :
notify-host-by-slack $USER1$/slack_nagios.pl -field slack_channel="$CONTACTPAGER$" -field -field HOSTALIAS="$HOSTNAME$" -field NOTES="$HOSTNOTES$" -field HOSTSTATE="$HOSTSTATE$" -field HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
notify-service-by-slack :
notify-service-by-slack $USER1$/slack_nagios.pl -field slack_channel="$CONTACTPAGER$" -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
===============================================================
contact used for slack integration has the settings proper.
Re: How to edit the slack notification alerts
The notification format is controlled by the Slack app and not something that XI can change. You'll need to contact the App developers to see if it can be modified. They provide [email protected] on the app page - https://slack.com/apps/A0F81R747-nagios?next_id=0
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
Re: How to edit the slack notification alerts
would it be possible to add the field "HOSTGROUP" to the notify-host-by-slack or notify-service-by-slack command .
Re: How to edit the slack notification alerts
It's an available macro(see https://assets.nagios.com/downloads/nag ... olist.html) and can be added to the commands.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
Re: How to edit the slack notification alerts
I added the Feld but do not see any alerts format changed. do we need to restart any service for that or any other contact we need to set up for this.
Kindly help
Kindly help
Re: How to edit the slack notification alerts
The notification format is controlled by the Slack app and not something that XI can change. You'll need to contact the App developers to see if it can be modified. They provide [email protected] on the app page - https://slack.com/apps/A0F81R747-nagios?next_id=0
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
Re: How to edit the slack notification alerts
can u at-least give the field name for the below command line as what field can i use for the "hostgroup name".
Command Line:
$USER1$/slack_nagios.pl -field slack_channel="#hosts" -field HOSTALIAS="$HOSTNAME$" -field HOSTSTATE="$HOSTSTATE$" -field HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
see the attached screenshot and see how can i use the filed hostgroup name in the command .
Command Line:
$USER1$/slack_nagios.pl -field slack_channel="#hosts" -field HOSTALIAS="$HOSTNAME$" -field HOSTSTATE="$HOSTSTATE$" -field HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
see the attached screenshot and see how can i use the filed hostgroup name in the command .
You do not have the required permissions to view the files attached to this post.
Re: How to edit the slack notification alerts
The command could be edited to look like:
Code: Select all
$USER1$/slack_nagios.pl -field slack_channel="#hosts" -field HOSTALIAS="$HOSTNAME$" -field HOSTSTATE="$HOSTSTATE$" -field HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$" -field HOSTGROUPNAME="$HOSTGROUPNAME$"As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
Re: How to edit the slack notification alerts
i fixed it by editing the below:
edit the commands and change the following: -field HOSTALIAS=“$HOSTNAME$”
to
-field HOSTALIAS=“$HOSTNAME$ - $HOSTGROUPNAME$”
edit the commands and change the following: -field HOSTALIAS=“$HOSTNAME$”
to
-field HOSTALIAS=“$HOSTNAME$ - $HOSTGROUPNAME$”
Re: How to edit the slack notification alerts
Thanks for the update and providing a work around.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.