Page 1 of 1
NagioXI integration with Slack
Posted: Mon Mar 11, 2019 5:42 pm
by romanshujain
Hi Team,
I am integrating NagioXI with Slack. I have followed below document to integrate nagiosxi with slack.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
When running below command on command prompt i am getting output in slack channel.
./slack_nagios.pl -field slack_channel=#hosts -field HOSTALIAS="Test Host" -field HOSTSTATE="UP" -field HOSTOUTPUT="Host is UP" -field NOTIFICATIONTYPE="RECOVERY"
But after complete the all steps on Ngaioxi UI, when services is changing its status it is not triggering any notification to slack. Please help ASAP.
Re: NagioXI integration with Slack
Posted: Tue Mar 12, 2019 11:06 am
by cdienger
There are a lot of steps in that document so try to go over it again and make sure nothing was missed. If it is still not working after doing this, please PM a copy of the slack_nagios.pl as well as a profile from Admin > System Config > System Profile > Download Profile.
Re: NagioXI integration with Slack
Posted: Tue Mar 12, 2019 12:51 pm
by romanshujain
I have followed all the steps mentioned in document correctly and reviewed it again.
Also, When i executed below command from terminal i am getting output in Slack (Page no 7). So It mean it is configured correctly.
./slack_nagios.pl -field slack_channel=#hosts -field HOSTALIAS="Test Host" -field HOSTSTATE="UP" -field HOSTOUTPUT="Host is UP" -field
NOTIFICATIONTYPE="RECOVERY"
PFA as requested.
Re: NagioXI integration with Slack
Posted: Tue Mar 12, 2019 2:17 pm
by npolovenko
@romanshujain, I see that you're monitoring 409 hosts and 2754 services with this XI but the slack contact is assigned to only 1 host -> eqwezp005. So it will only alert you if something happens with this specific host.
The second thing I noticed is that your commands (notify host by slack and notify service by slack) use the #general channel. But when you were running a test command you used the #hosts channel in slack?
Lastly, it doesn't look like you created a slack XI user. Please see page 10 of this tutorial:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Re: NagioXI integration with Slack
Posted: Tue Mar 12, 2019 2:50 pm
by romanshujain
Thanks for the response.
1. Yes you are correct, I am monitoring many host and services but slack contact is assign only 1 host and 2 services because of testing purpose, I intentionally down those 2 services which are assigned slack contact but still it is not notify me on slack.
2. yes, I have created 2 commands(slack_host_notification_handler, slack_service_notification_handler) and they are using #general channel. Also, When i am executing command test command i put #general channel, In my previous post i forgot to mention it. Below is correct command.
./slack_nagios.pl -field slack_channel=#general-field HOSTALIAS="Test Host" -field HOSTSTATE="UP" -field HOSTOUTPUT="Host is UP" -field NOTIFICATIONTYPE="RECOVERY"
PS- commands(notify host by slack and notify service by slack) mentioned you are not present in my command.
3. I have created slack user. username is slack and name is Slack Integration.
Please let me know if any additional info required from my side.
Re: NagioXI integration with Slack
Posted: Tue Mar 12, 2019 3:22 pm
by cdienger
What do the permissions look like on the slack_nagios.pl file? Run "ll /usr/local/nagios/libexec/slack_nagios.pl" and make sure it's owned by nagios:nagios with executable permissions.
Are you waiting long enough for the service to go into a HARD state? The handler will only be triggered if it reaches a HARD state which can take up to 7 minutes based on the configuration.
Re: NagioXI integration with Slack
Posted: Tue Mar 12, 2019 4:32 pm
by romanshujain
slack_nagios.pl file is owned by nagios:nagios and permission are set as 775(rwxrwxr-x).
-rwxrwxr-x 1 nagios nagios 2712 Mar 11 15:17 slack_nagios.pl
Yes I am waiting enough for the service to go into a HARD state. I did schedule immediate check as well.
Re: NagioXI integration with Slack
Posted: Wed Mar 13, 2019 3:35 pm
by cdienger
Log into the slack account and make sure notifications are enabled on their account. See the attached screenshot.