Hello,
I have a slight problem with the check_http result with my nagios.
I try to check a certain page with the check_http command. When I try it on the command line it gives me back the correct result. Also within a batch program echo $? gives 0 if ok and 2 if critical. All well here.
But when I use the command with nagios, I get a critical result, but the code for error allways gives me back a 0. So allways an OK.
PASSIVE SERVICE CHECK: NLHOLNAGIOS01;SYSTEM: MultiMedia;0;HTTP CRITICAL: HTTP/1.0 200 OK - string Keesje not found on http://bla die bla.nl
Above the strange result. HTTP Critical with a code 0.
I use nagios-plugins 1.4.15 and nagios 3.1.2
I use the command check_http -H <servername> -u <difficult uri> -s keesje
Has anybody seen this behaviour before?
Wilco
check_http result not as expected
Re: check_http result not as expected
Can you post the send_nsca command you're you're sending that with?
Re: check_http result not as expected
Hello,
We installed the standard NSCA commands as described in the documentation.
All other services return normal statusvalues.
It is a distributed environment at our customers. I thought Nagios took care of the send_nsca statements (as far as I know), I never changed them.
If this is not what you wanted, plz give me a direction were to go and what you wanted to see.
We installed the standard NSCA commands as described in the documentation.
All other services return normal statusvalues.
It is a distributed environment at our customers. I thought Nagios took care of the send_nsca statements (as far as I know), I never changed them.
Code: Select all
define command{
command_name submit_check_result
command_line /appl/nagios/libexec/eventhandlers/submit_check_result_via_nsca $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$'
}
Re: check_http result not as expected
Hello,
found new stuff in debugging file:
Conclusion: sending string is OK.
But why is telling me on the other side that the CRITICAL became 0 ?!
Something at the Main Nagios implementation is going wrong?
Any ideas?
Wilco
found new stuff in debugging file:
Code: Select all
Running command '/appl/nagios/libexec/eventhandlers/submit_check_result_via_nsca NLHOLNAGIOS01 'SYSTEM: MultiMedia' CRITICAL 'HTTP CRITICAL: HTTP/1.0 200 OK - string Keesje not found on http://string bladibla.nl.....- 263 bytes in 0.018 second response time''...
But why is telling me on the other side that the CRITICAL became 0 ?!
Something at the Main Nagios implementation is going wrong?
Any ideas?
Wilco
Re: check_http result not as expected
Hello,
Found the problem.
The file submit_check_result_via_nsca submited the statuscodes as CRITICAL instead of the value of CRITICAL which is 2. So I added some code to the batch file and VOILA
I ended up with this code:
Found the problem.
The file submit_check_result_via_nsca submited the statuscodes as CRITICAL instead of the value of CRITICAL which is 2. So I added some code to the batch file and VOILA
I ended up with this code:
Code: Select all
#!/bin/sh
# SUBMIT_CHECK_RESULT_VIA_NSCA
# Written by Ethan Galstad (egalstad@nagios.org)
# Last Modified: 17-02-2011 (W. Groothand wgroothand@gmail.com)
#
# This script will send passive check results to the
# nsca daemon that runs on the central Nagios server.
# If you simply want to submit passive checks from the
# same machine that Nagios is running on, look at the
# submit_check_result script.
#
# Arguments:
# $1 = host_name (Short name of host that the service is
# associated with)
# $2 = svc_description (Description of the service)
# $3 = return_code (An integer that determines the state
# of the service check, 0=OK, 1=WARNING, 2=CRITICAL,
# 3=UNKNOWN).
# $4 = plugin_output (A text string that should be used
# as the plugin output for the service check)s
#
#
# Note:
# Modify the NagiosHost parameter to match the name or
# IP address of the central server that has the nsca
# daemon running.
printfcmd="/usr/bin/printf"
NscaBin="/appl/nagios/bin/send_nsca"
NscaCfg="/appl/nagios/etc/send_nsca.cfg"
NagiosHost="<IP ADDRESS>"
NagiosPort="<PORTNUMBER>"
Result=0
if [ $3 = "OK" ] ; then
Result=0
fi
if [ $3 = "WARNING" ] ; then
Result=1
fi
if [ $3 = "CRITICAL" ] ; then
Result=2
fi
if [ $3 = "UNKNOWN" ] ; then
Result=3
fi
# Fire the data off to the NSCA daemon using the send_nsca script
$printfcmd "%s\t%s\t%s\t%s\n" "$1" "$2" "$Result" "$4" | $NscaBin -H $NagiosHost -p $NagiosPort -c $NscaCfg
# EOF
Re: check_http result not as expected
Thanks for the update and glad to see you got it working