URL Macro processing (was Re: Nagios 3.0.x-cvs bugs/odd things)

Thomas Guyot-Sionnest thomas at zango.com
Wed May 7 17:26:43 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.


- -----

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'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...

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIIcoz6dZ+Kt5BchYRApdbAJ9I85yHu3r7ImywrrMzILAyGUVauACg5AAo
QFZQn77qugSEL06+/CqtrMc=
=ByXo
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone




More information about the Developers mailing list