Page 1 of 2

HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Wed Apr 12, 2017 11:21 pm
by Nessero
Hi ! Have strange request from check_http after configure
/usr/local/nagios/libexec/check_http portal.work.com
HTTP WARNING: HTTP/1.1 400 Bad Request - 391 bytes in 0.745 second response time |time=0.744530s;;;0.000000 size=391B;;;0

I know theare load balancer, how can i configure correcct command ?

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Thu Apr 13, 2017 1:41 pm
by mcapra
Can you run check_http with verbose output (-v) enabled and share the (sanitized) output? It may offer some clues:

Code: Select all

/usr/local/nagios/libexec/check_http portal.work.com -v
Does this portal have a specific port that needs to be used other than 80/443?

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Thu Apr 13, 2017 10:30 pm
by Nessero
mcapra wrote:Can you run check_http with verbose output (-v) enabled and share the (sanitized) output? It may offer some clues:

Code: Select all

/usr/local/nagios/libexec/check_http portal.work.com -v
Does this portal have a specific port that needs to be used other than 80/443?

Code: Select all

root@web01:~# /usr/local/nagios/libexec/check_http portal.work.com -v
GET / HTTP/1.0
User-Agent: check_http/v2.1.4 (nagios-plugins 2.1.4)
Connection: close
Accept: */*


http://portal.work.com:80/ is 391 characters
STATUS: HTTP/1.1 400 Bad Request
**** HEADER ****
Server: nginx
Date: Fri, 14 Apr 2017 03:25:29 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 226
Connection: close

**** CONTENT ****
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>

HTTP WARNING: HTTP/1.1 400 Bad Request - 391 bytes in 0.503 second response time |time=0.503225s;;;0.000000 size=391B;;;0

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Fri Apr 14, 2017 7:58 am
by dwhitfield
Is this a public website? Can you pm the URL so that we can test? If you pm make sure you update this thread so it comes back up on our portal.

UPDATE: addresses shared with techs

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Tue Apr 18, 2017 11:25 pm
by Nessero
dwhitfield wrote:Is this a public website? Can you pm the URL so that we can test? If you pm make sure you update this thread so it comes back up on our portal.
Send you pm, please check.

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Wed Apr 19, 2017 9:58 am
by dwhitfield
You need a -H before the host. Note also the difference if you use -S versus not using it.

Code: Select all

[root@centos7x64 scripts]# /usr/local/nagios/libexec/check_http -H portal.com -S
HTTP OK: HTTP/1.1 200 OK - 10029 bytes in 1.521 second response time |time=1.520601s;;;0.000000 size=10029B;;;0
[root@centos7x64 scripts]# /usr/local/nagios/libexec/check_http -H portal.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 368 bytes in 1.545 second response time |time=1.544647s;;;0.000000 size=368B;;;0

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Mon Apr 24, 2017 4:37 am
by Nessero
dwhitfield wrote:You need a -H before the host. Note also the difference if you use -S versus not using it.

Code: Select all

[root@centos7x64 scripts]# /usr/local/nagios/libexec/check_http -H portal.com -S
HTTP OK: HTTP/1.1 200 OK - 10029 bytes in 1.521 second response time |time=1.520601s;;;0.000000 size=10029B;;;0
[root@centos7x64 scripts]# /usr/local/nagios/libexec/check_http -H portal.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 368 bytes in 1.545 second response time |time=1.544647s;;;0.000000 size=368B;;;0
I reconfigure my .cfg file, change

Code: Select all

check_command
from

Code: Select all

check_http
on

Code: Select all

check_http!-HS
in cli its working, returns 200,ОК but when in .cfg its not work. In web nagios shows

Code: Select all

HTTP OK: HTTP/1.1 301 Moved Permanently
. When check nagios -v /usr/local/nagios/nagios.cfg nothing errors shows.

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Mon Apr 24, 2017 3:29 pm
by ssax
Try using the -f follow option:

Code: Select all

/usr/local/nagios/libexec/check_http -H portal.work.com -f follow

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Mon Apr 24, 2017 10:28 pm
by Nessero
ssax wrote:Try using the -f follow option:

Code: Select all

/usr/local/nagios/libexec/check_http -H portal.work.com -f follow
change to

Code: Select all

check_http!-H!-f follow
nothing changes in web, HTTP OK: HTTP/1.1 301 Moved Permanently - 352 bytes in 0.115 second response time

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Posted: Tue Apr 25, 2017 10:40 am
by cdienger
The command should look like this:

define command{
command_name check_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}


and then the check command:

check_command check_http!-f follow