[PATCH] - 3.0.3 / 3.2.0 - enhanced diagnostic output when a regular expression fails to compile (xodtemplate.c)

Max perldork at webwizarddesign.com
Mon Mar 29 21:49:18 CEST 2010


Hi,

For Nagios 3.0.3 and 3.2.0.

http://github.com/netoisstools/Nagios-3-Patches/blob/master/xodtemplate.c.patch

Patched to provide better diagnostic output when a regular expression
compile (regcomp()) in xodtemplate.c fails.

Example output post-patch for a file file.cfg with a hostgroup line of

hostgroups +my_correct_additive_group,another_group,+my_host_group

Error: Invalid regular expression '+my_host_group' found while
expanding host group names in file '/path/to/file.cfg' starting on
line 23.  NOTE: regex could be inherited from a template in a
different file.

The largest value in this patch is shown in the case above  ..  when
use_regexp_matching is set to 1 in nagios.cfg and someone accidentally
puts an additive inheritence '+' sign in the middle of a line instead
of at the beginning of a line.  Without the patch a generic 'error occured'
error message is shown with no file reference etc.  I put the "NOTE*
section in place as I did find that by the time the regular expression
compilation is done template inheritence had been completed and so the
invalid regular expression could have come from a different template
... but at least the user knows which object definition triggered it,
which regular-expresasion enabled attribute triggered it, and in which
file, which for us has made the process of tracking down invalid '+'s
in inheritable attribute lines a 1-2 minute process instead of the
30-45+ minute plus time it used to take us before the patch.

Special thanks to our managers at Comcast - Eric Scholz, Mike Fischer,
and Jason Livingood, for allowing us to contribute our work on Nagios
back to the Nagios community.

- Max

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev




More information about the Developers mailing list