check_http 400 and 404 for popular websites

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.
Post Reply
eimrek
Posts: 2
Joined: Thu Jul 06, 2023 11:08 am

check_http 400 and 404 for popular websites

Post by eimrek »

Hi! I need checks for external links on my website and I'm running into problems with check_http for some websites.

See these examples:

1. www.nature.com, gives 400 Bad Request

Code: Select all

$ check_http -I www.nature.com -v                                 
GET / HTTP/1.0
User-Agent: check_http/v2.2 (monitoring-plugins 2.2)
Connection: close


http://www.nature.com:80/ is 694 characters
STATUS: HTTP/1.1 400 Bad Request
**** HEADER ****
Connection: close
Content-Length: 273
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
X-Cdn-Origin: SNPaaS
Accept-Ranges: bytes
Date: Thu, 06 Jul 2023 16:12:21 GMT
Via: 1.1 varnish
X-Served-By: cache-fra-eddf8230033-FRA
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1688659941.052221,VS0,VE102
alt-svc: h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400
**** CONTENT ****
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>400 Bad Request</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Bad Request</h1>
<h2>Your client has issued a malformed or illegal request.</h2>
<h2></h2>
</body></html>

HTTP WARNING: HTTP/1.1 400 Bad Request - 694 bytes in 0.125 second response time |time=0.124696s;;;0.000000;10.000000 size=694B;;;0

2. www.snf.ch, gives 404 Not Found

Code: Select all

$ check_http -I www.snf.ch -v
GET / HTTP/1.0
User-Agent: check_http/v2.2 (monitoring-plugins 2.2)
Connection: close


http://www.snf.ch:80/ is 274 characters
STATUS: HTTP/1.1 404 Not Found
**** HEADER ****
Date: Thu, 06 Jul 2023 16:15:26 GMT
Content-Type: text/html
Content-Length: 146
Connection: close
**** CONTENT ****
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

HTTP WARNING: HTTP/1.1 404 Not Found - 274 bytes in 0.013 second response time |time=0.013416s;;;0.000000;10.000000 size=274B;;;0
Both of these websites work well with curl and wget on the same server.

Version:

Code: Select all

$ icinga2 -V
icinga2 - The Icinga 2 network monitoring daemon (version: r2.13.3-1)
Other websites, such as www.google.com work well.

I have tried to mess around with all the various options (-f, -A, -S, ...) but nothing seems to work. Does anybody have any ideas how to make this work?
kg2857
Posts: 233
Joined: Wed Apr 12, 2023 5:48 pm

Re: check_http 400 and 404 for popular websites

Post by kg2857 »

-I means the arg is an IP address. Try reading the -h output and correcting the syntax.
eimrek
Posts: 2
Joined: Thu Jul 06, 2023 11:08 am

Re: check_http 400 and 404 for popular websites

Post by eimrek »

Thanks! any idea why

Code: Select all

$ check_http -I www.google.com 
HTTP OK: HTTP/1.0 200 OK - 19572 bytes in 0.157 second response time |time=0.156920s;;;0.000000;10.000000 size=19572B;;;0
works?
Post Reply