Nagios3 - Nagdash Install

##Required on all Nagios servers

Installing the required packages:

apt-get install wget gcc python3-openssl python-dev git python-pip build-essential libssl-dev libffi-dev php5-curl

Installing the HTTP web socket:

pip install diesel

Installing Nagios-API:

cd /etc/nagios3/
git clone https://github.com/zorkian/nagios-api.git
cd nagios-api/

Checking if the Nagios-API service is working properly:

./nagios-api -p 8090 -c /var/lib/nagios3/rw/nagios.cmd -s /var/cache/nagios3/status.dat -l /var/log/nagios3/nagios.log

Creating the Nagios-API service:

touch /etc/init.d/nagios-api
chmod a+x /etc/init.d/nagios-api
vim /etc/init.d/nagios-api
#!/bin/bash
case $1 in
start) start-stop-daemon --start --exec /etc/nagios3/nagios_api --pidfile /var/run/nagios-api.pid --background
       ;;
stop)  start-stop-daemon --stop --pidfile /var/run/nagios-api.pid
       ;;
esac

Creating the Nagios-API start-up script:

touch /etc/nagios3/nagios_api
chmod a+x /etc/nagios3/nagios_api
vim /etc/nagios3/nagios_api
#!/bin/bash
/etc/nagios3/nagios-api/nagios-api -p 8090 -c /var/lib/nagios3/rw/nagios.cmd -s /var/cache/nagios3/status.dat -l /var/log/nagios3/nagios.log &>> /var/log/nagios3/nagios-api.log &

##Required only where the Nagdash web service will be installed

Download https://github.com/lozzd/Nagdash

Move it to /usr/share/nagios3/

Rename the PHP configuration file:

mv config.php.example config.php

Edit the PHP configuration file and insert all Nagios instances on that i.ie:

$nagios_hosts = array(
   array("hostname" => "127.0.0.1", "port" => "8090", "protocol" => "http", "tag" => "A", "tagcolour" => "#336699"),
   array("hostname" => "192.168.1.1", "port" => "8090", "protocol" => "http", "tag" => "B", "tagcolour" => "#696969"),
   array("hostname" => "192.168.1.1", "port" => "8090", "protocol" => "http", "tag" => "C", "tagcolour" => "#4169E1"),

Edit the Nagios3 Apache settings in /etc/nagios3/apache.conf:

Alias /nagdash /usr/share/nagios3/Nagdash-master/htdocs
<DirectoryMatch (/usr/share/nagios3/Nagdash-master/htdocs)>
       Options FollowSymLinks
       DirectoryIndex index.php index.html
       AllowOverride AuthConfig
       Order Allow,Deny
       Allow From All
       AuthName "Nagios Access"
       AuthType Basic
       AuthUserFile /etc/nagios3/htpasswd.users
       require valid-user
</DirectoryMatch>

##Nagdash Filters

If you want to filter out all the excess alerts such as printers, press space bar (you may have to click onto the page for the key press to register) You’ll be presented with the nagdash options screen find the section called “Hostname regex” and paste this code into it:

^((?!PROJECTOR|PRINTER|PLOTTER).)*$