Bug and (loosely related) patch: Nagios 3.2.1 config.cgi, commands with $ARGs$

Michael Friedrich michael.friedrich at univie.ac.at
Sat Aug 28 11:00:30 CEST 2010


Hi,

On 2010-08-24 23:30, Jochen Bern wrote:
> Bug noticed while working on the attached patch: If you use a command
> anywhere *other* than as a service's check_command that has "!" and
> $ARGs$ (e.g., define a host with
>
> 	check_command		check-host-alive!foo!bar!baz
>
> ), when showing the config in question, config.cgi fails to strip the
> suffix before passing the command into url_encode(). The net result is
> that the page displaying the command makes it into a hyperlink to, e.g.,
>
> 	config.cgi?type=commands#check-host-alive%21foo%21bar%21baz
>
> while the actual list of commands only provides an anchor like
>
> 	<A NAME='check-host-alive'></A>check-host-alive
>
> so clicking the link fails to scroll to the proper line.
>
> -------
>
> Having that said, and after seeing too many people unable to do $ARGn$
> substitution correctly in their head or with pen and paper, I wrote a
> patch for config.c which makes the links display the appropriate
> "expansion" right away. I.e., if your config reads
>
> define command{
> 	command_name	check-host-alive
> 	command_line	$USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$
> 				-c $ARG2$ -n $ARG3$
> }
> define host{
> 	host_name	TestBox
> 	check_command	check-host-alive!3000.0,80%!5000.0,100%
> }
>
> and you click the link "check-host-alive!3000.0,80%!5000.0,100%" in
> TestBox's line in the list of host configurations, rather than jumping
> into the middle of an unannotated list of commands, you get a page saying:
>
> To expand:		check-host-alive!3000.0,80%!5000.0,100%
> check-host-alive	$USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$
> 			-c $ARG2$ -n $ARG3$
> 		->	$USER1$/check_icmp -H $HOSTADDRESS$ -w
> 			3000.0,80% -c 5000.0,100% -n (undefined/empty)
>
> complete with<FONT COLOR=>-based visual aids.
>
> Kind regards,
> 								J. Bern
>    

Very nice patch for the classic UI. Works as expected and helps a lot. 
Keep up the good work! :-)

Kind regards,
Michael

PS: Spam the *other* list too, pls ;-)

-- 
DI (FH) Michael Friedrich

Vienna University Computer Center
Universitaetsstrasse 7 A-1010 Vienna, Austria

email: 	michael.friedrich at univie.ac.at
phone: 	+43 1 4277 14359
fax: 	+43 1 4277 14279
web:	http://www.univie.ac.at/zid

Icinga Core&  IDOUtils Developer
http://www.icinga.org


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d




More information about the Developers mailing list