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
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