HTTP/1.1 404 Not Found

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
kolyan007
Posts: 6
Joined: Wed Oct 12, 2011 5:44 pm

HTTP/1.1 404 Not Found

Post by kolyan007 »

Hi there,

I'm using Nagios 3.3.1 and would like to check webpage like mysite/2.0/api.svc
From console all ok:
/usr/local/nagios/libexec/check_http -H mysite.com -u /2.0/API.svc
HTTP OK: HTTP/1.1 200 OK - 3063 bytes in 0.049 second response time |time=0.048513s;;;0.000000 size=3063B;;;0

But via nagios webpage I'm getting:
HTTP WARNING: HTTP/1.1 404 Not Found - 492 bytes in 0.002 second response time

Nagios config see below:
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}

define host{
use windows-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the windows-server host template definition.
host_name mysite.com
alias Server
address xxx.xxx.xxx.xxx
}

define service {
use generic-service
host_name mysite.com
service_description API
check_command check_http!-u /2.0/api.svc
}

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

Re: HTTP/1.1 404 Not Found

Post by jsmurphy »

Will your webserver reply if it is contacted directly via IP instead of hostname? right now Nagios is not trying to connect to hostname.com/2.0/api it's trying to connect to xxx.xxx.xxx.xxx/2.0/api if you change $HOSTADDRESS$ to $HOSTNAME$ in the command definition that may resolve your problem if it's sensitive to that sort of thing.
kolyan007
Posts: 6
Joined: Wed Oct 12, 2011 5:44 pm

Re: HTTP/1.1 404 Not Found

Post by kolyan007 »

Excellent. Works as magic.

# 'check_http2' command definition
define command{
command_name check_http2
command_line $USER1$/check_http -H $HOSTNAME$ $ARG1$
}

define host{
use windows-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the windows-server host template definition.
host_name mysite.com
alias Web
address mysite.com
}

define service {
use generic-service
host_name mysite.com
service_description API
check_command check_http2!-u /2.0/API.svc
}

Many thanks for your help!
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: HTTP/1.1 404 Not Found

Post by jsmurphy »

You're welcome :D
Locked