Your message dated Thu, 8 Dec 2016 16:41:21 +0100
with message-id <[email protected]>
and subject line Re: [Pkg-nagios-devel] Bug#722482: check_http: fix for
different virtual port
has caused the Debian Bug report #722482,
regarding check_http: fix for different virtual port
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
722482: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=722482
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: nagios-plugins
Version: 1.4.16-1
Severity: normal
Tags: patch upstream
Dear Maintainer,
we have two webservers behind a loadbalancer. The LB acts as a NAT and
PAT gateway, so requests to www.uni-paderborn.de:80 are forwarded to
siri1.uni-paderborn.de:5033 and siri2.uni-paderborn.de:5033.
Now I want to monitor both webservers, not only the LB. So I want to
use check_http with the following options:
check_http -I siri1 -p 5033 -H www.uni-paderborn.de:80
But in this case the current version of check_http (also checked the version in
unstable, same result) creates an HTTP request to siri1:80 which is wrong.
If I leave out the ":80" in the virtual host the request is wrong also:
check_http -I siri1 -p 5033 -H www.uni-paderborn.de -v | grep Host
Host: www.uni-paderborn.de:5033
So the plugin does distinguish between physical and virtual host names,
but it does NOT distinguish between physical and virtual ports.
I have already reported this bug upstream as bug id 3442015 two years ago
but have never received any answer. A patch was included also. This patch
still applies cleanly to the current version.
http://sourceforge.net/tracker/?func=detail&aid=3442015&group_id=29880&atid=397599
Christopher
-- System Information:
Debian Release: 7.1
APT prefers stable
APT policy: (700, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages nagios-plugins depends on:
ii nagios-plugins-basic 1.4.16-1
ii nagios-plugins-standard 1.4.16-1
Versions of packages nagios-plugins recommends:
pn nagios-plugins-contrib <none>
Versions of packages nagios-plugins suggests:
ii icinga 1.7.1-6
-- no debconf information
#! /bin/sh /usr/share/dpatch/dpatch-run
## check_http_virtual_ports.dpatch by Christopher Odenbach <[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Patch for check_http to understand the concept of virtual ports
@DPATCH@
--- nagios-plugins-1.4.15/plugins/check_http.c 2011-11-28 16:35:25.000000000 +0000
+++ nagios-plugins-1.4.15.new/plugins/check_http.c 2011-11-28 13:26:56.000000000 +0000
@@ -90,10 +90,12 @@
int specify_port = FALSE;
int server_port = HTTP_PORT;
+int virtual_port = 0;
char server_port_text[6] = "";
char server_type[6] = "http";
char *server_address;
char *host_name;
+int host_name_length;
char *server_url;
char *user_agent;
int server_url_length;
@@ -334,11 +336,25 @@
case 'H': /* Host Name (virtual host) */
host_name = strdup (optarg);
if (host_name[0] == '[') {
- if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */
- server_port = atoi (p + 2);
+ if ((p = strstr (host_name, "]:")) != NULL) { /* [IPv6]:port */
+ virtual_port = atoi (p + 2);
+ /* cut off the port */
+ host_name_length = strlen (host_name) - strlen (p) - 1;
+ free (host_name);
+ host_name = strndup (optarg, host_name_length);
+ if (specify_port == FALSE)
+ server_port = virtual_port;
+ }
} else if ((p = strchr (host_name, ':')) != NULL
- && strchr (++p, ':') == NULL) /* IPv4:port or host:port */
- server_port = atoi (p);
+ && strchr (++p, ':') == NULL) { /* IPv4:port or host:port */
+ virtual_port = atoi (p);
+ /* cut off the port */
+ host_name_length = strlen (host_name) - strlen (p) - 1;
+ free (host_name);
+ host_name = strndup (optarg, host_name_length);
+ if (specify_port == FALSE)
+ server_port = virtual_port;
+ }
break;
case 'I': /* Server IP-address */
server_address = strdup (optarg);
@@ -484,6 +500,9 @@
if (http_method == NULL)
http_method = strdup ("GET");
+ if (virtual_port == 0)
+ virtual_port = server_port;
+
return TRUE;
}
@@ -829,11 +848,11 @@
* 14.23). Some server applications/configurations cause trouble if the
* (default) port is explicitly specified in the "Host:" header line.
*/
- if ((use_ssl == FALSE && server_port == HTTP_PORT) ||
- (use_ssl == TRUE && server_port == HTTPS_PORT))
+ if ((use_ssl == FALSE && virtual_port == HTTP_PORT) ||
+ (use_ssl == TRUE && virtual_port == HTTPS_PORT))
asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
else
- asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
+ asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, virtual_port);
}
/* optionally send any other header tag */
@@ -1255,6 +1274,9 @@
MAX_PORT, server_type, server_address, server_port, server_url,
display_html ? "</A>" : "");
+ /* reset virtual port */
+ virtual_port = server_port;
+
if (verbose)
printf (_("Redirection to %s://%s:%d%s\n"), server_type,
host_name ? host_name : server_address, server_port, server_url);
--- End Message ---
--- Begin Message ---
Source: 2.2-1
Hi Christopher,
Am 11.11.16 um 18:50 schrieb Jan Wagner:
> Am 11.11.2016 um 12:55 schrieb Christopher Odenbach:
>> upstream has just accepted my patch (which is now 5 years old), so
>> maybe you could now integrate it into the package?
>
> thanks for the notification. I'm aware of this as I'm also working on
> the upstream project.
this should be fixed with the latest upload of monitoring-plugins to
unstable. I just did not mention it in the changelog, so need to close
this issue now.
Thanks and cheers, Jan.
--
Never write mail to <[email protected]>, you have been warned!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT d-- s+: a C+++ UL++++ P+ L+++ E--- W+++ N+++ o++ K++ w--- O M+ V- PS
PE Y++
PGP++ t-- 5 X R tv- b+ DI D+ G++ e++ h---- r+++ y++++
------END GEEK CODE BLOCK------
signature.asc
Description: OpenPGP digital signature
--- End Message ---