URL Macro processing (was Re: Nagios 3.0.x-cvs bugs/odd things)
Ethan Galstad
nagios at nagios.org
Mon May 19 18:52:41 CEST 2008
Thomas Guyot-Sionnest wrote:
> Thomas Guyot-Sionnest wrote:
> | Thomas Guyot-Sionnest wrote:
> | | Hi list, hi Ethan,
> | |
> | | I finally started to upgrade my prod servers to 3.0.x (latest CVS for
> | | now). Here are some bugs/odd things I came across:
> |
> | Oh well, one more thing. I use to set the service actionurl to
> |
> http://server/nagios/cgi-bin/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$
> | (and something similar for hosts) and something magically replaced
> | spaces in service names with + so that the url was working in text emails.
> |
> | This no longer works. Did it change (was it expected)? Is there any way
> | to enable it back or I have to use an external script or html emails? It
> | doesn't seem to be documented anywhere, not even in the what's new
> section.
>
> I ran with some debug output and there's something that catched my
> attention. While processing SERVICEACTIONURL I noted this:
>
> Cleaning options: global=3, local=4, effective=0
>
> To understand this line we have to look at common/macros.c:209:
>
> ~ /* include any cleaning options passed back to us */
> ~ macro_options=(options & clean_options);
>
> ~ log_debug_info(DEBUGL_MACROS,2," Cleaning options: global=%d,
> local=%d, effective=%d\n",options,clean_options,
>
> I'm not totally sure it I get the logic here: should the effective flags
> be global + local, or only flags that are in both global AND local?
>
> If I get it right then line 209 should rather look like:
>
> ~ macro_options=(options | clean_options);
>
> Which, ft I get the context right (this I'm not sure) would mean "apply
> both the parent macro options and the current macro options" while
> expanding macros that contain other macros.
I believe you are correct - I'll get this fixed ASAP.
>
> On a side note, it looks like the sample config is missing some debug
> values (DEBUGL_* defines). DEBUGL_MACROS is one of them (2048).
I'll get this fixed - thanks.
>
> I'm also wondering if it would be possible to have something like this:
> All custom macros starting with _STRIP_, _ESCAPE_ or _URL_ would be
> stripped, escaped or url-encoded. That would be very useful, for example
> in making custom URL macros. Possibly a Nagios 3.2 feature though...
>
An interesting idea. I'll keep this in mind for a future enhancement.
- Ethan Galstad
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
More information about the Developers
mailing list