Problem with check_http


#1

Hi,
I have installed and configured naigos in one system(centos). I am monitoring another centos system and a freeBSD system using this nagios. When i checked it by using check_http command which is there by default in commands.cfg. I used it for all 3 (2 systems mentioned above and another is the system in which naigos is installed. I am getting error while checking this.

The errors are like this

HTTP WARNING: HTTP/1.1 403 Forbidden { this is for the system in which nagios is installed and running.}

connection refused { this is the error in case of remaining 2 systems which this nagios is monitoring(centos and freeBSD)}

I have disabled firewalls in both centos systems.

please help me to solve this error
Thanks,
512


#2

Have you configured apache?


#3

hi,
Thanks for your reply.
I have configured Apache and am able to see my web interface and all.


#4

Hi,
I am still waiting for some help to make check_http work fine

512


#5

is nrpe configured properly ? on both machines ?

Can you please post the command that you are using


#6

Pls post the service check objects and your check_http command object


#7

Hi,
Thanks for your concern. This is my service check objects of http

define service{
use generic-service
host_name client,server
service_description HTTP
check_command check_http

This is my command object

define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}

Thanks,
512


#8
the **$ARG1$** implies that you need additional arguments in your service check object's check_command variable,  after check_http.
Looking briefly at the usage for check_http we can see the available arguments...
[blockquote][root@localhost libexec]# ./check_http
check_http: Could not parse arguments
Usage: check_http -H <vhost> | -I <IP-address> -u <uri>] -p <port>]
       -w <warn time>] -c <critical time>] -t <timeout>] -L]
       -a auth] -f <ok | warn | critcal | follow>] -e <expect>]
       -s string] -l] -r <regex> | -R <case-insensitive regex>] -P string]
       -m <min_pg_size>:<max_pg_size>] -4|-6] -N] -M <age>] -A string]
       -k string] -S] -C <age>] -T <content-type>]
[root@localhost libexec]# [/blockquote]

In it's simplest form you need to supply the -u argument, the URL you are checking... so you need to change your service object to something like
[blockquote]command_line check_http!-u [localhost/nagios/check.html](http://localhost/nagios/check.html) [/blockquote]
Anything after the "!" becomes $ARG1$ in the command object.  If you subsecquently start getting "401 Auth Req'd" then you may even need to add a username and password to the command_line, like
[blockquote]command_line check_http!-a <username>:<password> -u [localhost/nagios/check.html](http://localhost/nagios/check.html) [/blockquote]

HTH

/S

the $ARG1$ implies that you need additional arguments in your service check object’s check_command variable, after check_http.
Looking briefly at the usage for check_http we can see the available arguments…
[blockquote][root@localhost libexec]# ./check_http
check_http: Could not parse arguments
Usage: check_http -H | -I -u ] -p ]
-w ] -c ] -t ] -L]
-a auth] -f <ok | warn | critcal | follow>] -e ]
-s string] -l] -r | -R ] -P string]
-m <min_pg_size>:<max_pg_size>] -4|-6] -N] -M ] -A string]
-k string] -S] -C ] -T ]
[root@localhost libexec]# [/blockquote]

In it’s simplest form you need to supply the -u argument, the URL you are checking… so you need to change your service object to something like
[blockquote]command_line check_http!-u localhost/nagios/check.html [/blockquote]
Anything after the “!” becomes $ARG1$ in the command object. If you subsecquently start getting “401 Auth Req’d” then you may even need to add a username and password to the command_line, like
[blockquote]command_line check_http!-a : -u localhost/nagios/check.html [/blockquote]

HTH

/S


#9

Hi,
Thanks, I will check this once.
512


#10

hi,
I checked it. when i give just the URL the status information is as you said that auth is required. But, When i gave my username and password the status information is just null
and status is warning.
Please check this once.
Thanks,
512


#11

can you pls run the check in verbose mode (using -v) from the command line and post the result… like

[blockquote][root@localhost libexec]# ./check_http -v -I -a : -u ](http://)[/blockquote]


#12

Hi,
thanks for your concern. But, I am sorry to say that this statement too gave the same status ‘warning’ and same status report null.
Thanks,
512


#13

very odd, I’ve tried all sorts of wierd and wonderful mis-configurations and can’t get a NULL response for any of them. What is the url you are checking? I assume that when you access it from a browser that it loads up OK as without the auth you are at least getting the 401…

On our own nagios server here we are only checking a test page rather than one of the live nagios pages, I don’t know whether it might be worth you creating something similar and seeing if the check works for that… could rule out issues with the page you are trying to check, other than that, it is a mystery

[code][root@localhost libexec]# cat /var/www/html/check.html

Test [root@localhost libexec]# [/code]

#14

Hi,
I am giving the command as follows in my localhost.cfg which contains the service check commands.

check_http! -v -I <172.22.2.231> -a : -u my-ip-address/nagios/check.html

thakns,
512


#15

you should not put the “<>” around the IP address :slight_smile: (and also around username and pass);
Strides put them in the command line to say that you have to replace “” by your “IP address” :wink:


#16

hi,
If i give by removing the symbols u mentioned here then, the result is warning, with which the status information is GET 172.22.2.231/nagios/check.html HTTP/1.0

thanks,
512


#17

can you wget the page from the command line?


#18

hi,
I am getting a html page when used wget with that url.
I checked again but the error message i am getting is

GET localhost/nagios/check.html HTTP/1.0

Please check this once
thanks,
512


#19

Hi,
Should i use my proxy address at the place of the local host ipaddress. I think its not necessary as i have already exported my proxy address.

Thanks,
512.


#20

No because you want to check the http service on the box directly really, else you are only checking that the proxy can/has seen the page and might be returning a cached version. Is “GET localhost/nagios/check.html HTTP/1.0” really all it comes back with? Only it doesn’t really seem to be an error message… If not, please post the whole of the output from the commandline test.
[blockquote][root@localhost libexec]# ./check_http -v -I 127.0.0.1 -a nagiosadmin:Password -u localhost/nagios/check.html
GET localhost/nagios/check.html HTTP/1.0
User-Agent: check_http/v1861 (nagios-plugins 1.4.11)
Connection: close
Authorization: Basic cmanafE9zYWRtaW93em1eTRtNHf0

127.0.0.1:80http://localhost/nagios/check.html is 306 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Tue, 05 Aug 2008 07:49:18 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Mon, 31 Mar 2008 14:55:30 GMT
ETag: "23837e-2c-d7cc1c80"
Accept-Ranges: bytes
Content-Length: 44
Connection: close
Content-Type: text/html; charset=UTF-8
**** CONTENT ****

Test

HTTP OK HTTP/1.1 200 OK - 306 bytes in 0.005 seconds |time=0.005038s;;;0.000000 size=306B;;;0
[root@localhost libexec]# [/blockquote]