Install Nagios Server

Nagios is an enterprise class, open source software that can be used for network and infrastructure monitoring. You can monitor servers, switches, applications and services etc. It will alert the System Administrator or other groups when something goes wrong and also alerts back when the issues have been rectified.

First, make sure that all of the latest patches are installed.

sudo apt-get update
sudo apt-get dist-upgrade
sudo reboot

Install dependencies

sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev apache2-utils unzip snmp

Create Nagios User and Group

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -G nagcmd www-data

Install Nagios Core

cd /tmp
curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
 
tar xvf nagios-*.tar.gz
 
cd nagios-*
 
./configure --with-nagios-group=nagios --with-command=nagcmd
 
make all
 
sudo make install
sudo make install-commandmode
sudo make install-init
sudo make install-config
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf
 
chown nagios:nagcmd /usr/local/nagios/var/rw 
chown nagios:nagcmd /usr/local/nagios/var/rw/nagios.cmd

Install Nagios Plugins:

cd /tmp
curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
 
tar xvf nagios-plugins-*.tar.gz
 
cd nagios-plugins-*
 
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make
sudo make install

Create Web UI Admin Account

Create a nagiosadmin account fro logging into the Nagios web interface:

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

then restart the web server software:

sudo systemctl restart apache2

Configure Nagios

Once the software is installed, you should configure Nagios to your enviornment. There are many good web sites out there that cover this. I will not cover it here specifically since every environment is different.