HTTP WARNING: HTTP/1.1 400 Bad Request

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.
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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 ?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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?
Former Nagios employee
https://www.mcapra.com/
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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
Last edited by dwhitfield on Wed Apr 19, 2017 8:55 am, edited 1 time in total.
Reason: pm received
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post by ssax »

Try using the -f follow option:

Code: Select all

/usr/local/nagios/libexec/check_http -H portal.work.com -f follow
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked