HTTP WARNING: HTTP/1.1 400 Bad Request

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

HTTP WARNING: HTTP/1.1 400 Bad Request

Postby Nessero » Wed Apr 12, 2017 11:21 pm

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

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby mcapra » Thu Apr 13, 2017 1:41 pm

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://github.com/mcapra/
User avatar
mcapra
 
Posts: 2579
Joined: Thu May 05, 2016 3:54 pm

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby Nessero » Thu Apr 13, 2017 10:30 pm

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

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby dwhitfield » Fri Apr 14, 2017 7:58 am

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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3252
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby Nessero » Tue Apr 18, 2017 11:25 pm

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

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby dwhitfield » Wed Apr 19, 2017 9:58 am

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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3252
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby Nessero » Mon Apr 24, 2017 4:37 am

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

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby ssax » Mon Apr 24, 2017 3:29 pm

Try using the -f follow option:

Code: Select all
/usr/local/nagios/libexec/check_http -H portal.work.com -f follow
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 2947
Joined: Wed Feb 11, 2015 12:54 pm

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby Nessero » Mon Apr 24, 2017 10:28 pm

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

Re: HTTP WARNING: HTTP/1.1 400 Bad Request

Postby cdienger » Tue Apr 25, 2017 10:40 am

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

Next

Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot], mcapra, sartecat, tmattingly and 16 guests