check_http failing in some cases

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
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

check_http failing in some cases

Post by stecino »

Hello all,

I am running into an issue, where a simple http check hitting a java process http port fails

Here is the error:
[root@stageutil03 libexec]# ./check_http -H 10.198.6.16 -w 2 -c 4 -u '/datatracker?healthcheck=1' -p 8080
CRITICAL - Socket timeout after 10 seconds

But when I hit this process going through nginx that fronts this, I get 200 ok

[root@stageutil03 libexec]# ./check_http -H 10.198.6.16 -w 2 -c 4 -u '/datatracker?healthcheck=1' -p 8085
HTTP OK: HTTP/1.1 200 OK - 121 bytes in 0.004 second response time |time=0.004273s;2.000000;4.000000;0.000000 size=121B;;;0

And this is the curl command returning the response on the failing port in nagios
[root@stageutil03 libexec]# curl -I http://10.198.6.16:8080//datatracker?healthcheck=1
HTTP/1.1 200 OK
Content-Length: 6

What could be the issue? I have looked at the nrpe client logs, and it's not telling me much
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_http failing in some cases

Post by sreinhardt »

Interesting, have you tried the check_http with double slashes, like in your curl request?

Code: Select all

./check_http -H 10.198.6.16 -w 2 -c 4 -u '//datatracker?healthcheck=1' -p 8080
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: check_http failing in some cases

Post by stecino »

No go
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http failing in some cases

Post by tmcdonald »

What happens if you add -N (to ignore the document body) to the failing check? Could be the Java process on port 8080 is just slow. This would also make sense if the curl takes a while to run.
Former Nagios employee
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: check_http failing in some cases

Post by stecino »

Bingo!!!

[root@stageutil03 libexec]# ./check_http -N -H 10.198.6.16 -w 2 -c 4 -u '/datatracker?healthcheck=1' -p 8080
HTTP OK: HTTP/1.1 200 OK - 44 bytes in 0.003 second response time |time=0.002846s;2.000000;4.000000;0.000000 size=44B;;;0

Why is this?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http failing in some cases

Post by tmcdonald »

As far as I know, HTTP headers will show up most of the time regardless of the document body. The body can be delayed for various reasons, but the headers are usually instant. The -N flag just checks the headers and ignores the rest.
Former Nagios employee
Locked