check_http ?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

check_http ?

Post by Sbergonzi »

I'm configuring a URL check using check_http and it's erring. I can access the URL directly to a browser and it works fine, page displays with the text I'm searching for.

Code: Select all

Command:  /usr/local/nagios/libexec/check_http -H <my DNS> -s "<string to check for>" -f ok -I <my IP> -u "<web page unprotected>" -p 80

OUTPUT: HTTP CRITICAL: HTTP/1.1 302 Moved Temporarily - string '<string to check for>' not found on '<my web page>' - 150 bytes in 0.157 second response time |time=0.156609s;;;0.000000 size=150B;;;0
Any thoughts?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_http ?

Post by slansing »

Well it looks like it can't find the string you are trying to match, unfortunately since you blocked it out, and we likely don't have access to that site, there is not a whole lot we can do to check this. A 302 indicates a redirection issue, are you checking the first page of the primary address that DNS is giving you? Or are you checking a page further down the rabbit hole which you are normally redirected to? check_http has usage output regarding follow/redirect that may be of assistance. Try running the plugin like so to see these options:

Code: Select all

/usr/local/nagios/libexec/check_http -h
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: check_http ?

Post by Sbergonzi »

I've tried follow and that returns an SSL error, redirect isn't an option that I see for the -f parameter or any other parameter.

Code: Select all

OUTPUT: CRITICAL - Cannot make SSL connection.
The page is the first page of the DNS and the string does appear as quoted.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_http ?

Post by abrist »

Could you try changing -f ok to -f follow? (I am assuming the string you are looking for is on the redirected page)

Code: Select all

/usr/local/nagios/libexec/check_http -H <my DNS> -s "<string to check for>" -f follow -I <my IP> -u "<web page unprotected>" -p 80
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: check_http ?

Post by Sbergonzi »

i did, that's when i get the SSL error
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_http ?

Post by abrist »

Does the redirect force to 443? If so, don't specify a port, or try to change the port to 443:

Code: Select all

usr/local/nagios/libexec/check_http -H <my DNS> -s "<string to check for>" -f follow -I <my IP> -u "<web page unprotected>" -p 443
usr/local/nagios/libexec/check_http -H <my DNS> -s "<string to check for>" -f follow -I <my IP> -u "<web page unprotected>" 
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: check_http ?

Post by Sbergonzi »

Sorry, I should have added that detail. I have tried those options.
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: check_http ?

Post by Sbergonzi »

i changed the IP to be the direct server IP vs. our load balanced IP and that worked ok. It seems that was causing it.

thanks!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http ?

Post by tmcdonald »

Closing thread.
Former Nagios employee
Locked