Monday, 18 February 2013

Installing and configuring Nagios NRPE from source


Install and configure Nagios NRPE and NPRE Plugins

Before you start some dependencies:

zlib-devel             
libsepol-devel         
libselinux-devel       
keyutils-libs-devel    
e2fsprogs-devel        
krb5-devel             
openssl-devel 

# cd /usr/local

# wgethttp://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnagios%2Ffiles%2Fnrpe-2.x%2Fnrpe-2.14%2F&ts=1361216535&use_mirror=garr

# tar -zxvf nrpe-2.14.tar.gz

# cd nrpe-2.14


# ./configure --prefix=/usr/local/nagios


# make all

# adduser nagios

# mkdir /usr/local/nagios

# mkdir /usr/local/nagios/libexec

# mkdir /usr/local/nagios/share

# cp /usr/local/nrpe-2.14/src/nrpe /usr/local/nagios

# cp /usr/local/nrpe-2.14/src/check_nrpe /usr/local/nagios/libexec/

# cp /usr/local/nrpe-2.14/sample-config/nrpe.cfg /usr/local/nagios

# chown -R nagios: /usr/local/nagios

# add the line below to /etc/services on all servers to be monitored
nrpe 5666/tcp #NRPE



Modify /etc/xinetd.d/nrpe
Note: Do it on all servers and add the lines below:
# default: on
# description: NRPE
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = nagios
        server          = /usr/local/nagios/nrpe
        server_args     = -c /usr/local/nagios/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = <IPADDRESS of your Nagios Server>
}


# /etc/init.d/xinetd restart


# netstat -ant |grep 5666

Note: you should see a similar output as the one below
tcp     0    0 0.0.0.0:5666       0.0.0.0:* LISTEN

Installing Nagios NRPE plugins

# cd /usr/local

# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz

# tar -zxvf nagios-plugins-1.4.16.tar.gz

# cd nagios-plugins-1.4.16

# ./configure --prefix=/usr/local/nagios

# make all

# make install

NOTE: All plugins will be compiled and copied to /usr/local/nagios/libexec/

# chown nagios: -R /usr/local/nagios/libexec/

I will be writing about how to Install and configure Nagios server on next posts.

Something I would like to draw your attention to; once you have compiled the NRPE addon, you can simply tar the whole /usr/local/nagios folder and copy to remaining servers.

#tar -cvf nagios.tar /usr/local/nagios

by Renato


No comments:

Post a Comment