Page 1 of 1

check_http output mangled (similar to chunking problem?)

Posted: Wed Nov 04, 2015 6:48 am
by DigNetwerk
Hi,

Any reason why the content output from this is mangled?
# /usr/local/nagios/libexec/check_http -v -H ipv6-test.com -u '/json/webdns.php?url=stad.gent' --header='Host: ipv6-test.com' --header='Referer: http://ipv6-test.com/validate.php' --header='X-Requested-With: XMLHttpRequest'
GET /json/webdns.php?url=stad.gent HTTP/1.1
User-Agent: check_http/v2.0.3.85.gb94a (nagios-plugins 2.0.3)
Connection: close
X-Requested-With: XMLHttpRequest
Accept: */*
Host: ipv6-test.com
Referer: http://ipv6-test.com/validate.php


http://ipv6-test.com:80/json/webdns.php?url=stad.gent is 373 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Wed, 04 Nov 2015 11:42:57 GMT
Server: Apache/2.4.10 (Debian)
Access-Control: allow <http://ipv6-test.com>
Access-Control-Allow-Origin: http://ipv6-test.com
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

**** CONTENT ****
{"dns_ok"e,"ue,"dns_servers":["ns4.combell.net","ns3.combell.net"]}
HTTP OK: HTTP/1.1 200 OK - 373 bytes in 0.291 second response time |time=0.290510s;;;0.000000 size=373B;;;0
While it works with curl:
# curl -v 'http://ipv6-test.com/json/webdns.php?url=stad.gent' -H 'Accept: */*' -H 'Referer: http://ipv6-test.com/validate.php' -H 'X-Requested-With: XMLHttpRequest'
* About to connect() to ipv6-test.com port 80 (#0)
* Trying 5.135.165.173... connected
* Connected to ipv6-test.com (5.135.165.173) port 80 (#0)
> GET /json/webdns.php?url=stad.gent HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: ipv6-test.com
> Accept: */*
> Referer: http://ipv6-test.com/validate.php
> X-Requested-With: XMLHttpRequest
>
< HTTP/1.1 200 OK
< Date: Wed, 04 Nov 2015 11:44:14 GMT
< Server: Apache/2.4.10 (Debian)
< Access-Control: allow <http://ipv6-test.com>
< Access-Control-Allow-Origin: http://ipv6-test.com
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host ipv6-test.com left intact
* Closing connection #0
{"dns_ok":true,"dns_servers":["ns3.combell.net","ns4.combell.net"]}#

I think we have the latest version of check_http (maybe not by version number, but I dont think it has actually changed since then and plugins version 2.1.1)
# /usr/local/nagios/libexec/check_http -V
check_http v2.0.3.85.gb94a (nagios-plugins 2.0.3)

Re: check_http output mangled (similar to chunking problem?)

Posted: Wed Nov 04, 2015 3:40 pm
by rkennedy
For clarification, what part of the check_http do you think is mangled?

Is it this part?
{"dns_ok"e,"ue,"dns_servers":["ns4.combell.net","ns3.combell.net"]}
HTTP OK: HTTP/1.1 200 OK - 373 bytes in 0.291 second response time |time=0.290510s;;;0.000000 size=373B;;;0


against
{"dns_ok":true,"dns_servers":["ns3.combell.net","ns4.combell.net"]}#

Re: check_http output mangled (similar to chunking problem?)

Posted: Wed Nov 04, 2015 4:44 pm
by WillemDH
Indeed. That"s the part. Can you verify this at your end? This seems like a bug. You should be able to execute

Code: Select all

/usr/local/nagios/libexec/check_http -v -H ipv6-test.com -u '/json/webdns.php?url=stad.gent' --header='Host: ipv6-test.com' --header='Referer: http://ipv6-test.com/validate.php' --header='X-Requested-With: XMLHttpRequest'
Grtz

Re: check_http output mangled (similar to chunking problem?)

Posted: Thu Nov 05, 2015 11:53 am
by rkennedy
Do you know where that version came from of your check_http plugin? I can't seem to replicate it here, and nor can a colleague of mine.

Code: Select all

[root@localhost libexec]# ./check_http -V
check_http v2.0.3 (nagios-plugins 2.0.3)

Code: Select all

[root@localhost libexec]# ./check_http -v -H ipv6-test.com -u '/json/webdns.php?url=stad.gent' --header='Host: ipv6-test.com' --header='Referer: http://ipv6-test.com/validate.php' --header='X-Requested-With: XMLHttpRequest'
GET /json/webdns.php?url=stad.gent HTTP/1.1
User-Agent: check_http/v2.0.3 (nagios-plugins 2.0.3)
Connection: close
Host: ipv6-test.com
Accept: */*
Host: ipv6-test.com
Referer: http://ipv6-test.com/validate.php
X-Requested-With: XMLHttpRequest


http://ipv6-test.com:80/json/webdns.php?url=stad.gent is 209 characters
STATUS: HTTP/1.1 404 Not Found
**** HEADER ****
Date: Thu, 05 Nov 2015 16:48:50 GMT
Server: Apache/2.4.10 (Debian)
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
**** CONTENT ****
10
File not found.
0
HTTP WARNING: HTTP/1.1 404 Not Found - 209 bytes in 0.421 second response time |time=0.421092s;;;0.000000 size=209B;;;0
After removing the header paremeters -

Code: Select all

[root@localhost libexec]# ./check_http -v -H ipv6-test.com -u '/json/webdns.php?url=stad.gent'
GET /json/webdns.php?url=stad.gent HTTP/1.1
User-Agent: check_http/v2.0.3 (nagios-plugins 2.0.3)
Connection: close
Host: ipv6-test.com
Accept: */*


http://ipv6-test.com:80/json/webdns.php?url=stad.gent is 373 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Thu, 05 Nov 2015 16:49:11 GMT
Server: Apache/2.4.10 (Debian)
Access-Control: allow <http://ipv6-test.com>
Access-Control-Allow-Origin: http://ipv6-test.com
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
**** CONTENT ****
43
{"dns_ok":true,"dns_servers":["ns4.combell.net","ns3.combell.net"]}
0
HTTP OK: HTTP/1.1 200 OK - 373 bytes in 0.244 second response time |time=0.243817s;;;0.000000 size=373B;;;0

Re: check_http output mangled (similar to chunking problem?)

Posted: Thu Nov 05, 2015 12:04 pm
by WillemDH
Sorry, we forgot that this check_http we had is not yet released. It's this version => 2.1 RC1. There was an update to check_http made by Spenser as it did not support chunking. If the old version is still working there might be an issue with the chunking fix?

https://support.nagios.com/forum/viewto ... lit=+chunk

Re: check_http output mangled (similar to chunking problem?)

Posted: Thu Nov 05, 2015 3:55 pm
by rkennedy
Looks like this is related to nagios plugins 2.0.3 - 2.1.1 and is indeed a bug as I was able to replicate it -

Code: Select all

[root@localhost libexec]# ./check_http -V
check_http v2.1.1 (nagios-plugins 2.1.1)

Code: Select all

[root@localhost libexec]# ./check_http -v -H ipv6-test.com -u '/json/webdns.php?url=stad.gent' --header='Host: ipv6-test.com' --header='Referer: http://ipv6-test.com/validate.php' --header='X-Requested-With: XMLHttpRequest'
GET /json/webdns.php?url=stad.gent HTTP/1.1
User-Agent: check_http/v2.1.1 (nagios-plugins 2.1.1)
Connection: close
Host: ipv6-test.com
Accept: */*
Referer: http://ipv6-test.com/validate.php
X-Requested-With: XMLHttpRequest


http://ipv6-test.com:80/json/webdns.php?url=stad.gent is 373 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Thu, 05 Nov 2015 20:53:43 GMT
Server: Apache/2.4.10 (Debian)
Access-Control: allow <http://ipv6-test.com>
Access-Control-Allow-Origin: http://ipv6-test.com
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

**** CONTENT ****
{"dns_ok"e,"ue,"dns_servers":["ns3.combell.net","ns4.combell.net"]}
HTTP OK: HTTP/1.1 200 OK - 373 bytes in 0.375 second response time |time=0.375482s;;;0.000000 size=373B;;;0

Re: check_http output mangled (similar to chunking problem?)

Posted: Thu Nov 05, 2015 4:11 pm
by rkennedy
I have created a bug report for this at Nagios plugins ( https://github.com/nagios-plugins/nagio ... issues/121 ).

Thanks for letting us know about it. Do you mind if I close this thread out as a bug report has been filed?