patch for preprocessing macros

Matthias Eble matthias.eble at mailing.kaufland-informationssysteme.com
Mon May 7 21:19:55 CEST 2007


Hi list,

we moved check_cluster from contrib to the main distribution of the 
nagios plugins a couple of days ago. While writing the test cases, I 
remembered that I had had an issue to flexibly configure service 
clusters months ago, so i wrote a small patch to meet these needs 
(although i developed a workaround at that time).

The problem:
If there are multiple checks for one server process, eg. apache on port 
80 and port 443 a corresponding service cluster has to have a command 
line similar to this one:

   check_cluster -s \
   -d $SERVICESTATEID:myhost1:Port 443$,$SERVICESTATEID:myhost1:Port 80$

Templates cannot be used since myhost1 cannot be substituted by the 
$HOSTNAME$ macro due to nagios' macro substitution logic resulting in 
one service config for each host.

So i wrote a patch that can handle macros in on demand macros.

I originally thought about syntax like $SERVICESTATEID:$HOSTNAME$:Port$
but I couldn't imagine a way to distinguish between opening and closing 
$ signs. So my syntax contains braces and looks like this:

$SERVICESTATEID:{$HOSTNAME$}:svc_desc$

The code substitutes macros in curly braces first.

What do you think about it?

Thanks
Matthias



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: macro_preparse.patch
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070507/42f0a1e7/attachment.ksh>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list