[Pkg-nagios-devel] Bug#423461: http.cfg/check_http flawed arguments (-H/-I confusion)

Josip Rodin joy at debbugs.entuzijast.net
Fri May 11 23:44:14 UTC 2007


On Sat, May 12, 2007 at 01:34:55AM +0200, Josip Rodin wrote:
> Package: nagios-plugins-basic
> 
> Hi,
> 
> The config file change provided in #292124 had a bug: it gave the IP address
> ($HOSTADDRESS$) to the check_https command in both the -I and -H parameters.
> 
> Since the meaning of the -H parameter is to modify the Host: HTTP header,
> putting an IP address in it is fairly clearly nonsensical. Instead,
> the *name* should be put inside; the name of the virtual host.
> 
> The argument passed to -H should be $HOSTNAME$ instead.

I realized now that, oddly enough, Nagios documentation is not clear on
this. http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#host says:

host_name: 	This directive is used to define a short name used to
		identify the host. It is used in host group and service
		definitions to reference this particular host. Hosts can
		have multiple services (which are monitored) associated with
		them. When used properly, the $HOSTNAME$ macro will contain
		this short name.

alias: 	This directive is used to define a longer name or description used
	to identify the host. It is provided in order to allow you to more
	easily identify a particular host. When used properly, the
	$HOSTALIAS$ macro will contain this alias/description.

address: 	This directive is used to define the address of the host.
		Normally, this is an IP address, although it could really be
		anything you want (so long as it can be used to check the
		status of the host). You can use a FQDN to identify the host
		instead of an IP address, but if DNS services are not
		availble this could cause problems. When used properly, the
		$HOSTADDRESS$ macro will contain this address. Note: If you
		do not specify an address directive in a host definition,
		the name of the host will be used as its address. A word of
		caution about doing this, however - if DNS fails, most of
		your service checks will fail because the plugins will be
		unable to resolve the host name.

Which is to say - there is no really exact way for a plugin check to know
which variable is right for the Host: header, because we don't know whether
people put random garbage in their host_name/alias variables. For all we
know, they may be using domain names, rather than IP addresses, even though
it's not recommended. The problem is in those variable names, really - their
names mean something, but their value doesn't have to.

Nevertheless, I think you should try changing the default to use either
$HOSTNAME$ or $HOSTALIAS$, and see if there's fallout.

If necessary, the fallback procedure would be to add a separate set of
checkcommands which use the above variables in a more layered manner.

-- 
     2. That which causes joy or happiness.




More information about the Pkg-nagios-devel mailing list