How to install and configure Nagios monitoring server in Linux - Tips4ever

Latest

Hi this is Mahesh, Tips4ever is my IT Journey to technology, computers, software, Internet and much more....

Apr 20, 2012

How to install and configure Nagios monitoring server in Linux



This configuration is Redhat base Linux system.

1.Installing Nagios Required Packages
#yum install httpd php gcc glibc glibc-common gd gd-devel

2.Creating User account for Nagios
#useradd -m nagios
#passwd nagios

3.Creating group nagcmd and add it as a secondary group to nagios and Apache users
#groupadd nagcmd
#usermod -a -G nagcmd nagios
#usermod -a -G nagcmd apache

4.Download Nagios and nagios-plugins
#cd ~/Downloads
#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
#wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

5.Extract tar files
#tar -xvf nagios-3.2.0.tar.gz
#tar -xvf nagios-plugins-1.4.11.tar.gz

6.Compile and install Nagios
#cd nagios-3.2.0/
#./configure --with-command-group=nagcmd  ; configure the file
#make all  ; compile the files
#make install  ; Install the compiled source
#make install-init
#make install-config
#make install-commandmode

NOTE: If you want to email alert go to the file with your favorite editor /usr/local/nagios/etc/objects/contacts.cfg
and change email address of nagiosadmin to which address want to alert

7.after that install below 
#make install-webconf

8.Create nagisoadmin account for logging into the Nagios web interface.
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 
Asking for password enter ex:12345

9.Restart the Apache web server to make new settings.
#service httpd restart

10.Compile and install the nagios-plugins
#cd ~/Downloads/nagios-plugins-1.4.11/
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make
#make install

11.Add the nagios to the system services list and to autstart on system boot list
chkconfig --add nagios ;adding to system services list
chkconfig nagios on ;adding to auto startup on system boot

12.Verify the nagios sample configuration file
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If it shows total errors and warnings 0 when all is correct

13.Restart the nagios service
#service nagios restart

14.Modify the SElinux and iptables settings 
#setenforce 0 ; setting SElinux to Permissive mode

15.Change the context 
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

16.Flesh the iptables
#iptables -F
if you to permit save it
#service iptables save

Login into the nagios web interface by following
http://localhost/nagios ;Open this url in web browser and login with user is nagiosadmin and password which you given ex:12345