Tuesday, September 20, 2011

nrpe&nagios plugin installation.txt

Nagios plugins and nrpe installation in remote host.

useradd nagios
passwd nagios

download the source files using the below links

wget https://api.opensuse.org/public/source/home:netmax/nagios-plugins/nagios-plugins-1.4.6.tar.gz?rev=285448d8f1b79ea7d33cc6ee74ba65a1&

wget http://space.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.8/nrpe-2.8.tar.gz


tar -xvzf nagios-plugins-1.4.6.tar.gz\?rev\=285448d8f1b79ea7d33cc6ee74ba65a1
tar -xvzf nrpe-2.8.tar.gz

cd nagios-plugins-1.4.6
./configure
make
make install

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec

cd nrpe-2.8
./configure --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config

add the 5666 port no in /etc/services

Add the nagios host IP in the Allowed Host Directive of the nrpe.cfg file.

allowed_hosts=127.0.0.1,x.x.x.x

make sure that both the remote host and nagios hosts servers firewall blocks eachother ip's.

start nrpe plugin use the command below.

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

netstat -nat | grep 5666 or lsof -i tcp:5666

make sure that 5666 port listening

check whether nrpe is working,

/usr/local/nagios/libexec/check_nrpe -H localhost

if this returns the nrpe version then its working.


rndc issues

While restarting named or any services in the server, if you get the below log in Syslog or in messages

Sep 20 14:44:14 named[13573]: isc_socket_create: fcntl/reserved: Too many open
files
Sep 20 14:44:14 named[13573]: could not listen on UDP socket: not enough free resources

in addition in this time..you will have a issues in rndc also like below.

root@#rndc status
rndc: connect failed: 127.0.0.1#953: connection refused


due to this issues the newly created domains will not work because the IP associated with the new domains will not bind with the DNS.

if you do...

root@#telnet <new-ip> 25
connect failed: 127.0.0.1#953: connection refused
you will get the same error as like rndc.

Solution:

the problem is due to the user limit exceeded.

root@# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 106496
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 106496
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


The output will be like above.

open files (-n) 1024

increase this limit to 2000

root@#ulimit -n 2000

logout the terminal and login so that you can see the change. Now restart named and do rndc reload, telnet to newip for the port 53, everything will work.