OS: CentOS 6.2 i386
Nagios Version: 3.5.1
Hardware: Virtual Machine (VMware Server 2.0.0.2712)

About

Nagios is a great network monitor system that help you monitor all network devices in your computers networks.

Prerequisite

  • First we need to install the folllowing prerequisites packages: httpd php  gcc glibc glibc-common gd gd-devel kernel-headers libtool-ltdl-devel
yum install httpd php  gcc glibc glibc-common gd gd-devel kernel-headers libtool-ltdl-devel wget make perl -y
  • Add user for Nagios and add apache user to his group – Nagios will run with that user
/usr/sbin/useradd -m nagios
/usr/sbin/usermod -a -G nagios apache

Installing Nagios Core

  • Download Nagios and extract
mkdir -p /usr/local/src/nagios
cd /usr/local/src/nagios
wget https://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz -O nagios.tar.gz
tar zxf nagios.tar.gz
cd nagios
  • Run configure make and install nagios files
./configure
make all
  • Install Nagios main and config files, and themes
make install
make install-init
make install-commandmode
make install-config
make install-webconf

Now we need to install Nagios Plugins in order to start monitoring a network objects

Install Nagios Plugins

  • Download Nagios Plugins
cd /usr/local/src/nagios
wget https://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz -O nagios-plugins.tar.gz
tar zxf nagios-plugins.tar.gz
cd nagios-plugins-*
  •  Install dependencies
yum install openssl-devel gnutls-devel perl-devel libtap openssl net-snmp net-snmp-devel net-snmp-perl openldap openldap-devel mysql mysql-devel postgresql postgresql-devel smartmontools -y
  • Install rpmforge repository for more dependencies installation
rpm -Uhv https://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
  • Install more dependencies
yum install fping qstat radiusclient-ng radiusclient-ng-devel libxml2-devel libgtop2-devel net-snmp-utils perl-Net-SNMP perl-Net-DNS -y
  • Run configure make and make install
./configure
make
make install
  • Download snmp plugins
cd /usr/local/src/nagios/
wget https://nagios.manubulon.com/nagios-snmp-plugins.1.1.1.tgz
tar zxf nagios-snmp-plugins.1.1.1.tgz
cd nagios_plugins
./install.sh

cd /usr/local/nagios/libexec
wget "https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1855&cf_id=24" -O check_iftraffic3.pl
chmod +x check_iftraffic3.pl

Start Nagios

  • Configure apache and nagios to run at startup
chkconfig httpd on
chkconfig nagios on
  • Start apache and nagios
service httpd start
service nagios start
  • Create password for nagiosadmin user
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Nagios installation completed. Browse to https://nagios_server_ip_address/nagios and use nagiosadmin password to see default Nagios configuration.

You can extend Nagios use by installing addons using these guide:

Please visit https://www.nagios.org/documentation for information about Nagios configuration and usage.

Lahav Savir

Founder and CTO, Cloud Platforms

Read more posts by Lahav Savir