Thursday 12 September 2013

Nagios Server Installation

Nagios Server Installation

yum install httpd php
yum install gcc
yum install glibc glibc-common
yum install gd gd-devel

#/usr/sbin/useradd -m nagios

#passwd nagios

#/usr/sbin/groupadd nagcmd


#/usr/sbin/usermod -a -G nagcmd nagios

#/usr/sbin/usermod -a -G nagcmd apache

#cd /opt

#wget "http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz"
#tar  -zxvf nagios-3.4.1.tar.gz
#cd  nagios-3.4.1

#./configure --with-command-group=nagcmd
#make all; make install; make install-init; make install-config; make install-commandmode; make install-webconf


#vi /usr/local/nagios/etc/objects/contacts.cfg
email                           devendra.joshi@linukstricks.com


#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

#service  httpd   restart

#wget  "http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz"

#tar  -zxvf nagios-plugins-1.4.16.tar.gz
 #./configure --with-nagios-user=nagios --with-nagios-group=nagios
 #make; make   install
 #chkconfig --add nagios
 #chkconfig nagios on

#/usr/local/nagios/bin/nagios  -v   /usr/local/nagios/etc/nagios.cfg

#service  nagios  start

#iptables -I INPUT 1 -p tcp -s 0/0 -d 0/0 --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

#/etc/init.d/iptables  save

#/etc/init.d/iptables  restart

#now  open   your  browser  "http://localhost/nagios" OR "http://ip/nagios"


###########################################################################




Note:  Dependencies  require: gcc compiler.

#yum   install  gcc


Create a new nagios user account and give it a password.

/usr/sbin/useradd nagios
 passwd nagios

 cd   /opt
 wget "http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz"
tar zxvf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15

>>>> Compile and install the plugins

./configure --prefix=/opt/nagios
make
make install

>>> Create soft link

ln -s /opt/nagios /usr/local/nagios


>>> The permissions on the plugin directory and the plugins will need to be fixed at this point, so run the following
commands


chown -R  nagios.nagios /opt/nagios
chown -R nagios.nagios /opt/nagios/libexec
rm -rf /opt/nagios-plugins-1.4.15

yum install xinetd

 >>>>>> NoW   Install    NRPE

cd   /opt
wget "http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.13/nrpe-2.13.tar.gz"
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13


>>>> Compile NRPE     Note:  Dependencies require  openssl

# yum   install  openssl
# yum   install  openssl-devel
#./configure --prefix=/opt/nrpe

make all

>>>>Install the NRPE plugin (for testing), daemon, and sample daemon config file.

make install-plugin
make install-daemon
make install-daemon-config


>>>Install the NRPE daemon as a service under xinetd.

make install-xinetd

>>>> Create SOFT Link

 ln -s /opt/nrpe /usr/local/nrpe


>>>> Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive

 vi /etc/xinetd.d/nrpe

only_from       = 127.0.0.1      192.168.1.100


NOTE:    Where     192.168.1.100    Nagios server IP address.


>>> Add the following entry for the NRPE daemon to the /etc/services file


  vi    /etc/services

nrpe            5666/tcp                        # NRPE



>>>  Restart the xinetd service.

service xinetd restart
/etc/init.d/xinetd restart
chkconfig xinetd on

>>>>> Run   Below command   to check   nrpe  is   running  and  listening  on port  5666

lsof -i :5666
COMMAND PID USER   FD   TYPE  DEVICE SIZE NODE NAME
xinetd  919 root    5u  IPv4 8550033       TCP *:nrpe (LISTEN)



>>>>
Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that
was installed for testing purposes.

/opt/nrpe/libexec/check_nrpe -H localhost
NRPE v2.13

/usr/local/nrpe/libexec/check_nrpe -H localhost
NRPE v2.13



>>>>>> Open firewall rules  for  nrpe  5666  port should be accessible

 iptables -I INPUT 1 -p tcp -s 0/0 -d 0/0 --dport 5666 -m state --state NEW,ESTABLISHED -j ACCEPT

No comments:

Post a Comment