You are here

Send Slack notification to different channels for each host

6 posts / 0 new
Last post
Ryan Faith
ryan.faith's picture
Send Slack notification to different channels for each host

Scenario: I have multiple servers that have applications that are owned by different teams.  I'd like to send outage information to the appropriate Slack channel for that team.

I really like the Slack notification plugin that comes with Opsview 4.6.2.  I've read just about every article or post about it and can't find out how to set up multiple channels.  Even though the Slack plugin requires a hook on #channel1, it is able to send to #channel2 based on the configuration in Settings > Notification Methods > Slack.

I'm thinking that either I have multiple Slack Notification methods that separate the sending to a channel (i.e. Slack - Channel1 and Slack - Channel2), or maybe there is another way to set up Notification Profiles that I haven't figured out yet.  Solutions?

Duncan Ferguson
dferguson's picture
You will need to clone the

You will need to clone the notification method and have different configuration for each channel (although I haven't tested this myself)

  Duncs

Sandra F
sandra.fredenburgh's picture
Send Slack notification to different channels

I am looking to send notifications to different slack channesl with the same webhook.  I have cloned the notification method as suggested, but am unable to get past json errors.  I have created user variables and tried global variables.  Please help.

 

Duncan Ferguson
dferguson's picture
That error is being returned

That error is being returned after the message has been posted to slack, as though the response isn't in json format.

Looking at the error above,  'URL missing' suggests the webhook url is malformed in some way.  Do you have any further details in /usr/local/nagios/var/log/notify_by_hipchat.log (this is the logfile I see in the code)?

Can you also modify the command on the 'notification method' tab to add in '-d' as an arguement - this will produce some debugging information in the log file.

Sandra F
sandra.fredenburgh's picture
same error - no logs

I am getting the same error with debug. I am unable to find any logs associated with the notify_by_slack command. 

1. Is there a way to tune the logs?

2. Why can't I clone the Slack notification policy so that the webhook and channel are already present?

3. Is this solved in 6.0?  I was going to upgrade this week.

 

total 156

-rw-rw-r-- 1 nagios nagios  1364 Nov 27 20:16 create_and_send_configs.debug

-rw-rw-r-- 1 nagios nagios  4397 Dec 19  2017 DBVersion.log

-rw-rw---- 1 nagios nagios  8763 Nov 28 14:22 opsview_cronjobs.log

-rw-rw---- 1 nagios nagios 22149 Nov 25 03:11 opsview_cronjobs.log.1

-rw-rw---- 1 nagios nagios 22149 Nov 18 03:11 opsview_cronjobs.log.2

-rw-rw---- 1 nagios nagios 19328 Nov 11 03:11 opsview_cronjobs.log.3

-rw-rw---- 1 nagios nagios 24960 Nov  5 03:11 opsview_cronjobs.log.4

-rw-rw---- 1 nagios nagios 19338 Oct 28 03:11 opsview_cronjobs.log.5

-rw-rw---- 1 nagios nagios     0 Nov 25 03:11 opsviewmd.log

-rw-rw---- 1 nagios nagios     0 Nov 18 03:11 opsviewmd.log.1

-rw-rw---- 1 nagios nagios     0 Nov 11 03:11 opsviewmd.log.2

-rw-rw---- 1 nagios nagios     0 Nov  5 03:11 opsviewmd.log.3

-rw-rw---- 1 nagios nagios     0 Oct 28 03:11 opsviewmd.log.4

-rw-rw---- 1 nagios nagios     0 Oct 22 03:11 opsviewmd.log.5

 

Duncan Ferguson
dferguson's picture
I have made an update version

I have made an update version of the plugin available at https://s3-eu-west-1.amazonaws.com/opsview-customers/notify_by_slack which should provide better details on the issue when using the '-d' debug switch.  Please try it out andlet me know how you get on.

  Duncs