Nagios, now known as Nagios Core, is a free and open source computer-software application that monitors systems, networks and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications and services
Install Required Dependencies
# yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp
Create Nagios User and Group
# useradd nagios
# groupadd nagcmd
Next, add both the nagios user and the apache user to the nagcmd group.
# usermod -G nagcmd nagios
# usermod -G nagcmd apache
Download Nagios Core 4.3.4 and Nagios Plugin 2.2.1
Create a directory for your Nagios installation and all its future downloads.
# mkdir /root/nagios
# cd /root/nagios
Now download latest Nagios Core 4.3.4 and Nagios plugins 2.2.1 packages with wget command.
#wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
Extract Nagios Core and its Plugins
# tar -xvf nagios# tar -xvf nagios-4.3.4.tar.gz-4.3.4.tar.gz
# tar -xvf nagios-plugins-2.2.1.tar.gz
Configure Nagios Core
# cd nagios-4.3.4/
# ./configure --with-command-group=nagcmd
# make all
# make install
Following command will install the init scripts for Nagios.
# make install-init
To make nagios work from command line we need to install command-mode.
# make install-commandmode
Next, install sample nagios files, please run following command.
# make install-config
Customizing Nagios Configuratio
Open the “contacts.cfg” file with your choice of editor and set the email address associated with the nagiosadmin contact definition to receiving email alerts.
# vi /usr/local/nagios/etc/objects/contacts.cfg
Install and Configure Web Interface for Nagios
# make install-webconf
In this step, we will be creating a password for “nagiosadmin”. After executing this command, please provide a password twice and keep it remember because this password will be used when you login in the Nagios Web interface
# htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
# service httpd start
Login to the Nagios Web Interface
Your nagios is ready to work, please open it in your browser with “http://Your-server-IP-address/nagios” or “http://FQDN/nagios” and Provide the username “nagiosadmin” and password.