Nagios is an incredible open source monitoring tool. It is actually a full featured monitoring solution for your IT infrastructure. Nagios has capability of monitoring Servers, Firewalls, Routers, Switches, Services and Applications. We can access the Nagios using web interface.
With Nogios you can:
â€¢ Monitor your entire IT infrastructure
â€¢ Spot problems before they occur
â€¢ Know immediately when problems arise
â€¢ Share availability data with stakeholders
â€¢ Detect security breaches
â€¢ Plan and budget for IT upgrades
â€¢ Reduce downtime and business losses
In this Howto I will explain the steps involved in installing and configuring Nagios for monitoring your Centos 7 Server.
With this basic setup you will be able to monitor some important services of your Linux Server (Centos 7).
This guide is based on Centos 7, so i have already setup Centos 7 machine with minimal installation.
Our first requirement is to install Apache and PHP. Use the following yum command to install these packages.
# service httpd start
# chkconfig httpd on
Never forget to open http port in firewall.
Add accept rule in iptables to allow port 80 over the network.
Save newly added firewall rule, as it will be flushed on system restart or firewall service.
use below command to save newly added firewall rule.
Before installing Nagios we need to create one user and add nagcmd group, then add nagios and apache user in nagcmd group.
# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache
Downloadig and Compiling Nagios Core.
Change directory to /opt.
Extract tar file.
# cd /opt/nagios-4.0.7/
Now I am going to compile and configure it with the recently created user/group and some additional options:
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
For basic functioning of Nagios Some sample configuration files are created and installed under /usr/local/nagios/etc directory.
We need to update our email address in /usr/local/nagios/etc/objects/contacts.cfg config file for receiving monitoring related notifications and alerts.
Change the Email address with your own.
replace [email protected] < with your email address
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
Save & Exit.
Now create one username and password using apache authentication, which will use to access web interface of Nagios.
Downloading and Installing Nagios Plugins
Go to /opt directory and download plugin source file.
# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
# tar -zxvf /opt/nagios-plugins-2.0.3.tar.gz
# cd /opt/nagios-plugins-2.0.3/
Use following command to install and compile plugins.
# make install
Restart Apache service to make the new settings take effect.
Now verify and Start Nagios
Use the below commands to verify nagios install.
If there is no error return then start Nagios Service
Also configure nagios service to start on system start
Test Web Access
Open up web browser and point this url in address bar
http://192.168.1.200/nagios. [change server name or ip according to your setup].
You will be prompted for the username and password, provide username nagiosadmin and password whatever you kept.