[Nagiosplug-devel] [ nagiosplug-Patches-3442015 ] check_http: Fix for checking http on different virtual port

SourceForge.net noreply at sourceforge.net
Sun Jul 7 18:53:47 CEST 2013


Patches item #3442015, was opened at 2011-11-25 03:28
Message generated for change (Settings changed) made by hweiss
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=3442015&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: release-1.4.15
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Christopher Odenbach (odenbach)
>Assigned to: Holger Weiss (hweiss)
Summary: check_http: Fix for checking http on different virtual port

Initial Comment:
Patch against Plugin Version (-V output): 1.4.15
Plugin Name: check_http
Example Plugin Commandline:

with patch:
check_http -H www.uni-paderborn.de:80 -p 5033 -I siva1 -v | head -4
GET / HTTP/1.1
User-Agent: check_http/v1.4.15 (nagios-plugins 1.4.15)
Connection: close
Host: www.uni-paderborn.de


without patch:
check_http -H www.uni-paderborn.de:80 -p 5033 -I siva1 -v | head -4
GET / HTTP/1.1
User-Agent: check_http/v1.4.15 (nagios-plugins 1.4.15)
Connection: close
Host: www.uni-paderborn.de:80:5033


Tested on operating system: Debian Linux, Squeeze
Tested on architecture: amd64
Tested with compiler: x86_64-linux-gnu-gcc


Explanation:

We use a loadbalancer to balance http requests to our two webservers. On the loadbalancer we have defined several IP addresses for different web sites. On the webservers however we use different ports for the different sites. So www.uni-paderborn.de:80 is balanced to siva1.uni-paderborn.de:5033 and siva2.uni-paderborn.de:5033.
Now we want to check both web servers individually to tell if a single host has failed (if one host fails the site is still available over the other one so users do not recognize the error).
In the current version check_http does understand the concept of virtual hosts (using -H and -I), but it does not understand the concept of virtual ports. Let me make this clearer:

If I leave out the virtual port like this:

check_http -H www.uni-paderborn.de -p 5033 -I siva1 -v | head -4 
GET / HTTP/1.1
User-Agent: check_http/v1.4.15 (nagios-plugins 1.4.15)
Connection: close
Host: www.uni-paderborn.de:5033

The request then contains the physical port which is wrong.

If I add the virtual port to the hostname after the -H switch, I get the muddled up result from above.

The patch corrects this behaviour while leaving everything else as it was before. If only one port is given (either in -H or with -p), that one is taken as physical and virtual port.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=3442015&group_id=29880




More information about the Devel mailing list