Sunday, 27 April 2014

How to install nagios in RHEL|Centos|Fedora

Nagios is the industry standard in enterprise-class monitoring for good reason. It allows you to gain insight into your network and fix problems before customers know they even exist. It’s stable, scalable, supported, and extensible.

Install  Nagios

I First step  :

Let   me  show  you  how to install   nagios monitoring tool .
This  installation has been  tested  by  unixmen team  in  Fedora/Cenots/RHEL/ .
1- First   install some  tools : httpd, gcc, glib, glibc-common, gd and gd-devel
yum install httpd php
yum install gcc
yum install glibc glibc-common
yum install gd gd-devel
 
2- Create  nagios  user :
#/usr/sbin/useradd -m nagios
#passwd nagios
3- Add  nagcmd  group
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
4- Now go   to http://www.nagios.org   download  files  .
nagios-3.1.0.tar.gz  nagios-plugins-1.4.13.tar.gz  nrpe-2.12.tar.gz
tar  -zxvf  nagios-3.1.0.tar.gz  
cd  nagios-3.1.0
./configure --with-command-group=nagcmd
 #make all; make install; make install-init; make install-config; make install-commandmode; make install-webconf
5-  Edit  your  email  admin address :
Go to
vi /usr/local/nagios/etc/objects/contacts.cfg 

6- Create a nagiosadmin account for logging into the Nagios web interfaceassign to this you’ll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
enter   the  password.
7- Restart  the  httpd  server :
#Service  httpd   restart

The  second  step  : Extract   and  install  plugins

1- Go  to you  downloaded  nagios  tools
 tar  -zxvf   nagios-plugins-1.4.13.tar.gz
2- cd  nagios-plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make; make   install
3- Now  you  have  to  add nagios  to  Chkconfig
chkconfig --add nagios
chkconfig nagios on
4- Verify  if  you  have  a  good config of nagios with the command
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
5- Check if  there  are  no errors  displayed;  then start   nagios with command :
service  nagios  start


 Modify SELinux Settings

Fedora ships with SELinux (Security Enhanced Linux) installed and in Enforcing mode by default. This can result in "Internal Server Error" messages when you attempt to access the Nagios CGIs.


See if SELinux is in Enforcing mode.


getenforce

Put SELinux into Permissive mode.


setenforce 0

To make this change permanent, you'll have to modify the settings in /etc/selinux/config and reboot.


Instead of disabling SELinux or setting it to permissive mode, you can use the following command to run the CGIs under SELinux enforcing/targeted mode:


chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/

chcon -R -t httpd_sys_content_t /usr/local/nagios/share/


now  open   your  browser   and http://localhost/nagios orr http://ip/nagios


No comments:

Post a Comment