Nagios Slack alerts step by step


#1

Step1:- Install the necessary perl modules with:- sudo apt-get install libwww-perl libcrypt-ssleay-perl (or similar).

Step2:- Download the plugin and move it into place:
wget https://raw.github.com/tinyspeck/services-examples/master/nagios.pl and give excute perminssions to that file
chmod 755 /usr/local/bin/slack_nagios.pl

Step3:- Edit the nagios.pl , find the $opt_domain and $opt_token variables, and set them to:
you can find the Slack token:- https://ncodeit.slack.com/apps/A0F81R747-nagios

my $opt_domain = “ncodeit.slack.com” # Your team’s domain
my $opt_token = “wN1QjTXUKGxQPYCKbpJ84NlN” # The token from your Nagios services

Step4:- Goto Nagios console, under configure tab select core config manager and create new commands for (host, servers).

Like:- / usr/local/bin/nagios.pl -field slack_channel=#alerts -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"

Step5:- Goto admin tab----> manage users ----> create new user ----> apply configurations.

Step-6:- Go to Nagios console, under configure tab select configuration wizard and select the wizard (like:- amazon EC2, Linux server, etc…) from the search tab. And next specify required details (like:- IP, Destribution, Name, etc…).
It display like below:-
https://pin.it/uifppx5uiow5e2

Step-7:- Next page enables you to configure the wizard (like:- Host name, Server metrics, disk usage, services, process, etc…) by choosing the marking you want to monitor your host. and also specify Create Monitoring settings and notification settings.

https://pin.it/oy6rzsecjfhjkj
https://pin.it/zxxu6esqbwnv6j
https://pin.it/vch7czxvivrvil
https://pin.it/amfkq3mkvysjg5

Step8:- Goto Configure tab ----> Core config Manager -----> Contacts ----> Create new contact ---->
Under Common settings:-
Specify manage contact groups (admins)
Specify Manage contact templates (generic contacts)

https://pin.it/73xe5siw2gtbjz

Under alerting settings:-
Specify commands for Host and Servers.
And save it, configure the settings.

Step10:- Goto Nagios console ----> Under Configure tab ----> Host ----> Edit common, Check, Alerting settings and save apply configurations.
Edit Like below:-
https://pin.it/evs4b3ynkxpuol
https://pin.it/oyu2rzie53mg6v
https://pin.it/wfsugfocqqxlaz

Thank You.