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
HTTP/1.1 404 Not Found
Re: HTTP/1.1 404 Not Found
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.
Re: HTTP/1.1 404 Not Found
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!
# '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!