customizing Check_Ping on NRPE

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
eng_m_g
Posts: 19
Joined: Tue Mar 27, 2012 4:12 pm

customizing Check_Ping on NRPE

Post by eng_m_g »

Dears,

I'm new in configuring nagios ,
first I have nagios servers called RH1 which is responsible for monitoring my locally HP servers and switches by ping and snmp
Then I decided to make another nagios server as master nagios and make RH1 as NRPE remote nagios
Lets's say that
master nagios IP is 1.1.1.1 (public IP)
Remote nagios IP is 2.2.2.2 (public IP) and 3.3.3.3 (private IP)
HP server which is connected to Remote nagios 3.3.3.10 (private IP)

I configured NRPE on both master and remote servers under Xinetd
From master nagios I can make direct checks for services on the remote nagios like (chek_disk,check_swap…etc) through NRPE
but I can't make indirect checks for service ping for HP server which is connected to remote host RH1 and it gave me:
CRITICAL > CHECK_NRPE: Socket timeout after 10 seconds.

My configuration are :

Remote nagios:
I have added the ip of master nagios on /etc/xinetd.d/nrpe ===> 1.1.1.1
I have added an 5666/tcp entry for nrpe daemon on /etc/services
Add command for ping in /usr/local/nagios/etc/nrpe.cfg as following: command[check_ping]=/usr/local/nagios/libexec/check_ping -H 2.2.2.2 -w 3000.0,80% -c 5000.0,100% -p 5

Master Nagios

1. I have added command definition to use the check_nrpe plugin on /usr/local/nagios/etc/commands.cfg
2. I have created host and service definition as following:

define host{
name RH1
use generic-host
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0
}

##################################################################################################
define host{
use RH1
host_name RH1
address 2.2.2.2
}
###################################################################################################
define hostgroup{
hostgroup_name MediaCity
alias RH1
members RH1
}
###################################################################################################
define service{
use generic-service
host_name RH1
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name RH1
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name RH1
service_description /dev/mapper/VolGroup00-LogVol00 Free Space
check_command check_nrpe!check_sda1
}
define service{
use generic-service
host_name RH1
service_description Total Processes
check_command check_nrpe!check_total_procs
}

#############################################################
# HP Servers #
#############################################################
define host{
use generic-switch
host_name HP server
address 3.3.3.10
hostgroups MediaCity
}

#############################################
define service{
use generic-service
host_name HP server
service_description PING
check_command check_nrpe!check_ping!200.0,20%!600.0,60%
normal_check_interval 5
retry_check_interval 1
}
#############################################

Could you please find why I can't monitor the HP server from master nagios , and is there any faults in my configuration, u can modify any thing u see as I'm not expert :-)
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: customizing Check_Ping on NRPE

Post by jsmurphy »

are you able to also post your check_nrpe definition from commands.cfg?
eng_m_g
Posts: 19
Joined: Tue Mar 27, 2012 4:12 pm

Re: customizing Check_Ping on NRPE

Post by eng_m_g »

jsmurphy wrote:are you able to also post your check_nrpe definition from commands.cfg?


Dear jsmurphy,
FYI

# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: customizing Check_Ping on NRPE

Post by jsmurphy »

Hmmmm my initial hunch was that you were trying to pass arguments and that arguments were disabled on your remote NRPE instance... but it doesn't look like you are handling arguments anyway with your command definition.

Are you able to ensure logging is turned on for NRPE and run check_nrpe from the nagios server command line, once you get the "Time out" check /var/log/messages on your remote server and the NRPE daemon should tell you why it's rejecting the request.
eng_m_g
Posts: 19
Joined: Tue Mar 27, 2012 4:12 pm

Re: customizing Check_Ping on NRPE

Post by eng_m_g »

jsmurphy wrote:Hmmmm my initial hunch was that you were trying to pass arguments and that arguments were disabled on your remote NRPE instance... but it doesn't look like you are handling arguments anyway with your command definition.

Are you able to ensure logging is turned on for NRPE and run check_nrpe from the nagios server command line, once you get the "Time out" check /var/log/messages on your remote server and the NRPE daemon should tell you why it's rejecting the request.

Dear jsmurphy ,

when i tried /usr/local/nagios/etc/libexc/check_nrpe -H <IP of NRPE client>
it replied with NRPE V.3 and i found logs on /var/log/messages
but when i tried /usr/local/nagios/etc/libexc/check_nrpe -H <IP of NRPE client> -c check_ping -H <IP of sever connected to NRPE serevr>
i got CHECK_NRPE:Socket timed out after 10 seconds , and there is no logs creatred

kindly advice
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: customizing Check_Ping on NRPE

Post by jsmurphy »

If there are no NRPE logs on the remote host and you have logging enabled in your remote NRPE config, then the check isn't even getting to the server and you may want to check any firewalls between your nagios server and the remote server.

The way you worded your reply though leads me to believe you may have checked the wrong servers log file.
eng_m_g
Posts: 19
Joined: Tue Mar 27, 2012 4:12 pm

Re: customizing Check_Ping on NRPE

Post by eng_m_g »

jsmurphy wrote:If there are no NRPE logs on the remote host and you have logging enabled in your remote NRPE config, then the check isn't even getting to the server and you may want to check any firewalls between your nagios server and the remote server.

The way you worded your reply though leads me to believe you may have checked the wrong servers log file.

Dear Jsmurphy,

thank you for your reply, i'd like to inform you that i don't have any firewall enabled
eng_m_g
Posts: 19
Joined: Tue Mar 27, 2012 4:12 pm

Re: customizing Check_Ping on NRPE

Post by eng_m_g »

hi guys ,
is there any updates please
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: customizing Check_Ping on NRPE

Post by jsmurphy »

If there are no logs on the remote host for NRPE, either you have logging disabled or the network traffic is not reaching the server... I can't render any further assistance until you diagnose why the traffic isn't reaching the server.
Locked