Page 1 of 1

nagios log server alerting notification use slack

Posted: Tue Jul 10, 2018 4:06 am
by tinklabs
Dear Sir and Madam,
Is there any way to use slack of nagios log server alerting notification?
thanks

Re: nagios log server alerting notification use slack

Posted: Tue Jul 10, 2018 9:56 am
by cdienger
Nothing developed by us, but there is an 'execute script' alerting options if you'd like to create a customer alert that interfaces with the slack api:

https://api.slack.com/

Re: nagios log server alerting notification use slack

Posted: Wed Jul 11, 2018 11:42 pm
by nozlaf
I'd suggest sending alerts from NLS to Nagios XI (or Core) and from there to slack
a central point of administration and monitoring is essential to a healthy system admin

plus alert management in NLS is pretty much non existent (its really good at sending but not so good at handling), using core or XI to handle the alerts gives you the ability to really handle how alerts are managed

but if you want if I was to send alerts straight from NLS

I'd do it this way ....


I'd use the "official" nagios core integration from slack which you enable from here https://my.slack.com/services/new/nagios (follow their directions to get your token)

then script for your NLS server can be grabbed from here https://raw.githubusercontent.com/tinys ... /nagios.pl
i did

Code: Select all

cd /usr/bin  
wget https://raw.githubusercontent.com/tinyspeck/services-examples/master/nagios.pl -O slack.pl
chomd 555 slack.pl
then you will need to edit the script (/usr/bin/slack.pl) to supply your token and domain
find the lines that start like this

Code: Select all

my $opt_domain =
my $opt_token =

fill in your slack domain and your slack token that you would have generated if you followed the directions that the slack integration provided

if you are using the nagios supplied NLS VM you will need to install a couple of perl modules

Code: Select all

yum install perl-libwww-perl perl-LWP-Protocol-https 
and I setup the notification within NLS like this
nls alert definition.png
with the arguments set to

Code: Select all

 -field slack_channel=#NLS -field HOSTALIAS="NLS" -field SERVICEDESC="Apache404" -field SERVICESTATE="%status%" -field SERVICEOUTPUT="%output%"
and I test it
and I get

Code: Select all

NLS/Apache404 is ok:
\'OK: 0 matching entries found \|logs=0\;555\;1000\'

but I'd never do this I'd simply setup a service that received passive checks in Nagios Core and have NLS send the alert using NRDP to that service and have core handle the alerting and acknowledgements of the alerts

Re: nagios log server alerting notification use slack

Posted: Thu Jul 12, 2018 7:08 am
by scottwilkerson
Thanks @nozlaf!