I am trying to add a service monitor and my host and service configuration looks like this:
object Host “proof-review.acs.org-host” {
import “generic-host”
address = "proof-review.acs.org"
check_interval = "300"
display_name = "proof-review.acs.org"
vars = {
os = "Windows"
}
}
object Service “APRSHome-service” {
import “generic-service”
and it gives me this output on the Dashboard:
HTTP CRITICAL: HTTP/1.1 503 Service Unavailable - 879 bytes in 1.506 second response time
BUT, if run the check_http command directly, it gives me 200 OK
This is the check command I run:
./check_http -H proof-review.acs.org -u https://proof-review.acs.org/aprs/APRSHome.html -S -f follow --sni
And it gives me this output:
HTTP OK: HTTP/1.1 200 - 8995 bytes in 2.787 second response time |time=2.787258s;;;0.000000;10.000000 size=8995B;;;0
so, what I am doing wrong that it gives 503 on Dashboard??
I run the command directly by logging in as root to the Host Machine
root@icinga:/usr/lib/nagios/plugins# ./check_http -H proof-review.acs.org -u https://proof-review.acs.org/aprs/APRSHome.html -S -f follow --sni
HTTP OK: HTTP/1.1 200 - 8993 bytes in 3.111 second response time |time=3.111444s;;;0.000000;10.000000 size=8993B;;;0
Thank you But could you please suggest what we need to do here so that Icinga can execute the command with 200. And, also why it is giving 503 even though we can access the URL publicly?
It depends on the webserver’s setup. For example, a web hoster (Strato, Netcup, …) serves many different websites on the same host (same IP address).
If you look up the IP address of the web site you’re using, you’ll get 45.60.80.135. Just put this in the web browser and you receive a resolving error page, since the web server doesn’t know which site you wanna access. The same happens when using check_http with just the -I parameter.
So every time the webserver needs to know which website (vhost) you’re requesting, you have to specify via the -H flag.