nagios log server alerting notification use slack

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
tinklabs
Posts: 2
Joined: Sun Jun 24, 2018 9:08 pm

nagios log server alerting notification use slack

Post by tinklabs »

Dear Sir and Madam,
Is there any way to use slack of nagios log server alerting notification?
thanks
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: nagios log server alerting notification use slack

Post 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/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nozlaf
Posts: 172
Joined: Sun Nov 09, 2014 9:50 pm
Location: Victoria, Australia

Re: nagios log server alerting notification use slack

Post 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
You do not have the required permissions to view the files attached to this post.
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nagios log server alerting notification use slack

Post by scottwilkerson »

Thanks @nozlaf!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked