Nagios is a monitoring tools. With Nagios we can check systems, applications and services are working properly or not. If any service or application fail, Nagios can alert by email..
Step 1: Install Required Packages and Dependencies
We have to installed all require packages first. Use the following commands to install all require packages.
# yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp
After installing all packages need to start apache service.
# service httpd start
Step 2: Install Nagios Core Service
After installing required packages and its dependencies. Lets start Nagios core installation. Download latest nagios core from Nagios official site.
# cd /opt/
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.7.tar.gz
# tar xzf nagios-4.0.7.tar.gz
# cd nagios-4.0.7
# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
Step 3: Configure Nagios core Authentication with the help of Apache
Now we are going to setup Nagio authentication for user nagiosadmin. No need to change this username becuase If we change the username then we have to do alot of changes in configuration file.
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Now restart Apache service to make effect of changes.
# service httpd restart
Step 4: Install Nagios Plugins
After installing and configuring Nagios core service, Download latest nagios-plugins source file and install it using following commands.
# cd /opt
# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
# tar xzf nagios-plugins-2.0.3.tar.gz
# cd nagios-plugins-2.0.3
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make install
Step 5: Verify nagios and Start Nagios Service
Some time there is some miss configuration in Nagios configuration file so before starting Nagios service need to verify Nagios configuration. Use the following commands to verify nagios install and start nagios core service.
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios start
Also add nagios service to start on system
# chkconfig --add nagios
# chkconfig nagios on
Step 6: Access Nagios in Web Browser
Nagios creates its own configuration file /etc/httpd/conf.d/nagios.conf. No need to make any changes to it. Simply open below url in browser.
[change domain name with your domain or ip]