Tuesday, 8 March 2016

NRPE Installtion CentOS

NRPE Installtion CentOS:


Download nagios plugins and nrpe package

[Link:- http://kaz.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz]

[root@tlv8 downloads]# tar -xvzf nagios-plugins-1.4.16.tar.gz

[root@tlv8 downloads]# cd nagios-plugins-1.4.16

[root@tlv8 nagios-plugins-1.4.16]# useradd nagios

[root@tlv8 nagios-plugins-1.4.16]# yum install openssl-devel gcc

[root@tlv8 nagios-plugins-1.4.16]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios

[root@tlv8 nagios-plugins-1.4.16]# make (if it gives error make command not found )

optional [root@tlv8 nagios-plugins-1.4.16]# yum install make

[root@tlv8 nagios-plugins-1.4.16]# make install

[root@tlv8 nagios-plugins-1.4.16]# chown -R nagios:nagios /usr/local/nagios/libexec

[root@tlv8 nagios-plugins-1.4.16]# cd ..

Download NRPE Package:
Link:-  http://kaz.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz]

[root@tlv8 downloads]# tar -xvzf nrpe-2.14.tar.gz

[root@tlv8 downloads]# cd nrpe-2.14

[root@tlv8 nrpe-2.14]# ./configure

[root@tlv8 nrpe-2.14]# make all

[root@tlv8 nrpe-2.14]# make install-plugin

[root@tlv8 nrpe-2.14]# make install-daemon
[root@tlv8 nrpe-2.14]# make install-daemon-config
[root@tlv8 nrpe-2.14]# make install-xinetd
[root@tlv8 nrpe-2.14]# vi /etc/xinetd.d/nrpe ( add nagios ip on line allow from i.e. - 202.52.134.101)

[root@tlv8 nrpe-2.14]# vi /etc/services ( add this line at the end of file:- nrpe            5666/tcp                # NRPE )

[root@tlv8 nrpe-2.14]# chkconfig xinetd on
(if it gives below error :
error reading information on service xinetd: No such file or directory then install xinetd by:- yum install xinetd )

[root@tlv8 nrpe-2.14]# service xinetd restart

[root@tlv8 nrpe-2.14]# netstat -at |grep nrpe [ check nrpe port is open ]

[root@tlv8 nrpe-2.14]# /usr/local/nagios/libexec/check_nrpe -H localhost [ check nrpe is working ]

CHECK_NRPE: Error – Could not complete SSL handshake

Solution:-
check if in vi /etc/xinetd.d/nrpe
  allowed_from=  check nagios server ip

add nrpe command in below location

[root@server~]# /usr/local/nagios/libexec
keep here all nagios command which you want to monitored

Like  check_disk  check_dhcp

[root@server~]# vi /usr/local/nagios/etc/nrpe.cfg

add here below command which you want to monitored

like
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 1000 -c 1200
command[check_raid]=/usr/local/nagios/libexec/check_raid
command[check_yum]=sudo /usr/local/nagios/libexec/check_yum
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10%
command[check_md_raid]=sudo /usr/local/nagios/libexec/check_md_raid
command[check_mem]=/usr/local/nagios/libexec/check_mem -w 90,25 -c 95,50
command[check_cpu_perf]=sudo /usr/local/nagios/libexec/check_cpu_perf
command[check_uptime]=/usr/local/nagios/libexec/check_uptime

:wq


restart xinetd services


after above process complete then go to nagios server

create configuration file for monitored services
keep name is hostname.cfg

restart nagios service

HOW TO ADD OPEN VZ VPS IN NAGIOS
=================================

1. Not need to install nrpe on vps.
2. from hardware node :-copy nagios/ folder to vps /usr/local/
3. on hardware node:- add /usr/local/nagios/etc/nrpe.cfg

add below command

#smtpout    <-- vps hostname for indentification

command[check_disk_smtpout]=sudo /usr/sbin/vzctl exec2 145 /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p / 2>&1
command[check_total_procs_smtpout]=sudo /usr/sbin/vzctl exec2 145 /usr/local/nagios/libexec/check_procs -w 100 -c 120 2>&1
command[check_load_smtpout]=sudo /usr/sbin/vzctl exec2 145 /usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 2>&1


:wq


[syntax for example]
command[check_load_vpshostname]=sudo /usr/sbin/vzctl exec2 vps_id /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p / 2>&1

finally go to nagios server
create hostname.cfg file and add service which you want to monitor

No comments: