Page 1 of 2

HTTP URL monitor not working

Posted: Mon Mar 27, 2017 3:28 pm
by w-bao
Trying to deploy a Website URL monitor but got "HTTP CRITICAL: HTTP/1.1 503 Service Temporarily Unavailable" error. This website works fine when manually testing but it is protected by a 3rd party front-end called CloudFlare. I need to configure the HTTP monitor to work this front end.

Re: HTTP URL monitor not working

Posted: Mon Mar 27, 2017 3:35 pm
by avandemore
Here is the documentation for the check:

https://nagios-plugins.org/doc/man/check_http.html

What syntax are you using?

Re: HTTP URL monitor not working

Posted: Tue Mar 28, 2017 9:45 am
by w-bao
I use the Configuration Wizards -> Website URL monitor -> URL Status and URL Content
For URL Status, it is check_xi_service_http -f ok -I 104.16.92.31 -u '/' -S -p 443
For URL Content, it is check_xi_service_http -s "contentxxx" -f ok -I xxx.xxx.xxx.xxx -u '/' -S -p 443

Re: HTTP URL monitor not working

Posted: Tue Mar 28, 2017 10:20 am
by cdienger
Greetings, Are you still getting 503 errors? 503 usually indicates a problem with the service or problems between nagios and the http server.

I tested the commands and I get a 403 Forbidden message. It appears the site requires a valid Host header. This needs to be included with the -H option:

-f ok -I 104.16.92.31 -u '/' -S -p 443 -H <HOSTNAME>

Re: HTTP URL monitor not working

Posted: Tue Mar 28, 2017 3:17 pm
by w-bao
Sorry for '-H <HOSTNAME>', <HOSTNAME> would be the Nagios server name?

Re: HTTP URL monitor not working

Posted: Tue Mar 28, 2017 3:29 pm
by cdienger
Sorry for not being clear: -H would be the hostname of the destination server. www.example.com for example.

Re: HTTP URL monitor not working

Posted: Thu Mar 30, 2017 9:24 am
by w-bao
Here's what I tested with the same failure.

COMMAND: /usr/local/nagios/libexec/check_http -H images.nga.gov -f ok -I 104.16.92.31 -u '/' -S -p 443
OUTPUT: HTTP CRITICAL: HTTP/1.1 503 Service Temporarily Unavailable - 5072 bytes in 0.035 second response time |time=0.034862s;;;0.000000 size=5072B;;;0

Re: HTTP URL monitor not working

Posted: Thu Mar 30, 2017 9:35 am
by cdienger
Greetings, I am receiving a 503 message as well. It appears there may be something wrong with the service as the 503 code points to. The same command with other sites work. For example:

/usr/local/nagios/libexec/check_http -H www.google.com -f ok -I 74.125.193.105 -u '/' -S -p 443

Re: HTTP URL monitor not working

Posted: Thu Mar 30, 2017 9:58 am
by avandemore
The response you are getting from cloudflare is correct. That's what you sign up for when using that service:

Code: Select all

# curl -Iv https://images.nga.gov/
* About to connect() to images.nga.gov port 443 (#0)
*   Trying 104.16.91.31...
* Connected to images.nga.gov (104.16.91.31) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=images.nga.gov
*       start date: Mar 31 00:00:00 2016 GMT
*       expire date: May 30 23:59:59 2019 GMT
*       common name: images.nga.gov
*       issuer: CN=RapidSSL SHA256 CA,O=GeoTrust Inc.,C=US
> HEAD / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: images.nga.gov
> Accept: */*
>
< HTTP/1.1 503 Service Temporarily Unavailable
HTTP/1.1 503 Service Temporarily Unavailable
< Date: Thu, 30 Mar 2017 14:34:09 GMT
Date: Thu, 30 Mar 2017 14:34:09 GMT
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Connection: close
Connection: close
< Set-Cookie: __cfduid=de86e3ac00c6c335c7ff337c76413fd241490884449; expires=Fri, 30-Mar-18 14:34:09 GMT; path=/; domain=.nga.gov; HttpOnly
Set-Cookie: __cfduid=de86e3ac00c6c335c7ff337c76413fd241490884449; expires=Fri, 30-Mar-18 14:34:09 GMT; path=/; domain=.nga.gov; HttpOnly
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Refresh: 8;URL=/cdn-cgi/l/chk_jschl?pass=1490884453.373-IlY/B/i+bn
Refresh: 8;URL=/cdn-cgi/l/chk_jschl?pass=1490884453.373-IlY/B/i+bn
< Cache-Control: no-cache
Cache-Control: no-cache
< Server: cloudflare-nginx
Server: cloudflare-nginx
< CF-RAY: 347bc9c099075540-ORD
CF-RAY: 347bc9c099075540-ORD

<
* Closing connection 0
Do you this enabled or something? https://blog.cloudflare.com/introducing ... tack-mode/

Re: HTTP URL monitor not working

Posted: Thu Mar 30, 2017 2:24 pm
by w-bao
We use CloudFlare to protect our website including from robots, but how come it works with manual checking from browsers? Is there a different way Nagios can check on the health of URLs?