|
|
| Line 1: |
Line 1: |
| STEPS TO CONFIGURE NRPE AND NRPE PLUGIN ON CLIENT MACHINE:-
| |
|
| |
|
|
| |
| ON CLIENT MACHINE:
| |
|
| |
| Install libraries for dependencies as it would help in compiling the NRPE packages.
| |
|
| |
|
| |
| Step 1- install libraries
| |
|
| |
| # yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel
| |
|
| |
| step 2- user and password
| |
|
| |
| # useradd nagios
| |
| # passwd nagios
| |
|
| |
| step 3-extract plugins
| |
|
| |
| # tar –xvf nagios-plugins-1.5.tar.gz
| |
|
| |
| step 4- compile and install
| |
| # cd nagios-plugins-1.5
| |
| # ./configure
| |
| # make
| |
| # make install
| |
| step 5-permissions on plugins
| |
|
| |
| # chown nagios.nagios /usr/local/nagios
| |
| # chown -R nagios.nagios /usr/local/nagios/libexec
| |
| step 6-install xinetd
| |
|
| |
| #yum install xinetd
| |
|
| |
| step 7-install nrpe
| |
|
| |
| tar xzf nrpe-2.15.tar.gz
| |
| # cd nrpe-2.15
| |
| # ./configure
| |
| # make all
| |
| # make install-plugin
| |
| # make install-daemon
| |
| # make install-daemon-config
| |
| #make install-xinetd
| |
|
| |
| step 8-add nagios monitoring server ip
| |
|
| |
| #vim /etc/xinetd.d/nrpe
| |
| add only_from = 127.0.0.1 <nagios_ip_address>
| |
| #vim /etc/service
| |
| add nrpe 5666/tcp #NRPE
| |
|
| |
| step 9-restart xinetd
| |
|
| |
| #/etc/init.d/xinetd restart
| |
|
| |
| step 10-verify nrpe daemon
| |
|
| |
| # netstat -at | grep nrpe
| |
|
| |
| tcp 0 0 *:nrpe *:* LISTEN
| |
|
| |
| step 11-To check nrpe daemon is workig properly
| |
|
| |
| # /usr/local/nagios/libexec/check_nrpe -H localhost
| |
| NRPE v2.15
| |
|
| |
| step 12- customize nrpe commands and add commands
| |
|
| |
| # vim /usr/local/nagios/etc/nrpe.cfg
| |
| 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_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/vg_mail1-LogVol01
| |
| command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
| |
| command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 70
| |
| command[check_mem]=/usr/local/nagios/libexec/check_mem_avail -w 10 -c 5
| |
| command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 200 -c 250
| |
| command[check_zimbra_lmtp]=/usr/local/nagios/libexec/check_smtp -H localhost -p 7025 -e '220 node.sandhar.in Zimbra LMTP server ready'
| |
| command[check_smtp]=/usr/local/nagios/libexec/check_smtp -H localhost
| |
|
| |
| step 13 -run /etc/init.d/xinetd restart
| |
|
| |
| step 14 – reload nagios on nagios server:
| |
| #/etc/init.d/nagios reload
| |
|
| |
| step 15 -After then we should call all services from nagios server:
| |
| # /usr/local/nagios/libexec/check_nrpe -H 172.17.16.22 -c check_zimbra_lmtp
| |
| ERROR: could not complete SSL handshake
| |
| # /usr/local/nagios/libexec/check_nrpe -H 172.17.16.22 -c check_smtp
| |
| ERROR: could not complete SSL handshake
| |
|
| |
| That means we are not able to call services from nagios server to client machine. This is happening because of openssl library missing. For this we need to run nrpe as daemon with non ssl. The command is:
| |
| # /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d -n
| |
| Now in future whenever we will add services of mailserver in sandhar, we need to follow below steps:
| |
|
| |
| step 16-kill the nrpe running and run nrpe as daemon.
| |
| # ps -elf | grep nrpe
| |
| 0 S root 747 15083 0 80 0 - 25813 pipe_w 10:59 pts/0 00:00:00 grep nrpe
| |
| 5 S nagios 22682 1 0 80 0 - 9810 poll_s Feb02 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d -n
| |
|
| |
| # kill -9 22682
| |
| # /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d -n
| |
|
| |
| step -17 Now test from nagios server.
| |
| # /usr/local/nagios/libexec/check_nrpe -H 172.17.16.22 -c check_zimbra_lmtp
| |
| SMTP OK - 0.001 sec. response time|time=0.000956s;;;0.000000
| |
|
| |
| # /usr/local/nagios/libexec/check_nrpe -H 172.17.16.22 -c check_smtp
| |
| SMTP OK - 0.002 sec. response time|time=0.002258s;;;0.000000
| |
|
| |
| # /usr/local/nagios/libexec/check_nrpe -H 172.17.16.22 -c check_cpu
| |
| OK - user: 23.22, nice: 1.11, sys: 2.95, iowait: 0.62, irq: 0.50, softirq: 0.74 idle: 74.33 | 'user'=23.22 'nice'=1.11 'sys'=2.95 'softirq'=0.74 'iowait'=0.62 'irq'=0.50 'idle'=74.33
| |
|
| |
| # /usr/local/nagios/libexec/check_nrpe -H 172.17.16.22 -c check_queue
| |
| 33 mail(s) in queue | mail_queue=33
| |
|
| |
| step 18- Add host on nagios server of sandhar.
| |
| # vim /usr/local/nagios/etc/objects/linux-box.cfg
| |
| define host{
| |
| use linux-server
| |
| host_name CORP-MAILSERVER
| |
| alias CORP-MAILSERVER
| |
| address 172.17.16.22
| |
| hostgroups Windows Server
| |
| }
| |
|
| |
| step 19- Add services on nagios server.
| |
|
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Current Users
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_users
| |
| }
| |
|
| |
|
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Server Load
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_load
| |
| }
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Disk Space
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_hda1
| |
| }
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Zombie process
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_zombie_procs
| |
| }
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description CPU Load
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_cpu
| |
| }
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Memory Utilization
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_mem
| |
| }
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Mail Queue
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_queue
| |
| }
| |
| define service{ use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description Mail Queue
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_queue
| |
| }
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description LMTP
| |
| notification_options w,u,c,r
| |
| check_command check_nrpe!check_zimbra_lmtp
| |
| }
| |
|
| |
| define service{
| |
| use generic-service
| |
| host_name CORP-MAILSERVER
| |
| service_description SMTP
| |
| notification_options w,u,c,r
| |
| check_command check_smtp
| |
| }
| |
|
| |
| step 20- verify the nagios.cfg file.
| |
|
| |
| # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
| |
| Checking services...
| |
| Checked 815 services.
| |
| Checking hosts...
| |
| Checked 108 hosts.
| |
| Checking host groups...
| |
| Checked 5 host groups.
| |
| Checking service groups...
| |
| Checked 0 service groups.
| |
| Checking contacts...
| |
| Checked 16 contacts.
| |
| Checking contact groups...
| |
| Checked 12 contact groups.
| |
| Checking service escalations...
| |
| Checked 2962 service escalations.
| |
| Checking service dependencies...
| |
| Checked 0 service dependencies.
| |
| Checking host escalations...
| |
| Checked 0 host escalations.
| |
| Checking host dependencies...
| |
| Checked 0 host dependencies.
| |
| Checking commands...
| |
| Checked 70 commands.
| |
| Checking time periods...
| |
| Checked 6 time periods.
| |
| Checking for circular paths between hosts...
| |
| Checking for circular host and service dependencies...
| |
| Checking global event handlers...
| |
| Checking obsessive compulsive processor commands...
| |
| Checking misc settings...
| |
|
| |
| Total Warnings: 0
| |
| Total Errors: 0
| |
|
| |
| If we get below error in the escalation.cfg file that means there is empty services defined for any host. For this we need to check config file.
| |
| ERROR: could not expand the services defined in ‘service escalation’ config ( /usr/local/nagios/etc/objects/escalation.cfg )
| |
|
| |
| First disable the escalation.cfg in nagios.cfg file:
| |
| #cfg_file=/usr/local/nagios/etc/objects/escalation.cfg
| |
| Second verify the config file nagios.cfg file:
| |
| # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
| |
| It will show you the warning like this:
| |
| Checking host escalations...
| |
| Checked 0 host escalations.
| |
| Checking host dependencies...
| |
| Warning: ‘node1.sandhar.in’
| |
| Checking commands...
| |
| Checked 70 commands.
| |
|
| |
| To resolve this either you define the services for that host or disable that host. And verify the nagios.cfg file.
| |
| If total warnings is 0 and total errors is 0 then reload nagios.
| |
|
| |
| # /etc/init.d/nagios reload
| |