NRPE: Conditional parsing of nrpe.cfg supported?

Chester R. Hosey Chester.Hosey at gianteagle.com
Thu Aug 4 15:42:21 CEST 2005


On Thu, 2005-08-04 at 13:52 +0200, Ralph.Grothe at itdz-berlin.de wrote:
> Hi,
>  
> I wonder if something like this is possible in nrpe.cfg (with
> liberal artistic macrolike syntax here)
> 
> 
> 
> #if defined dont_blame_nrpe
> command[check_tns]=/export/oracle/V9.2.0
> PATH=/usr/bin:/export/oracle/V9.2.0/bin
> /usr/local/nagios/libexec/check_oracle --tns $ARG1$
> #else
> command[check_tns]=/export/oracle/V9.2.0
> PATH=/usr/bin:/export/oracle/V9.2.0/bin
> /usr/local/nagios/libexec/check_oracle --tns MY_SID
> #endif
> 
> 
> 
> Regards
> --
> Ralph Grothe

Not that I know of, but if you're looking for a preprocessor, use a
preprocessor!

I'd cp nrpe.cfg nrpe.cfg.m4, and edit nrpe.cfg.m4 to include something
like the following:

dnl This is the preprocessor source to nrpe.cfg
dnl Run it through m4 with 'm4 nrpe.cfg.m4' to
dnl generate usable output.

define(`DONT_BLAME_NRPE', `0')

# normal stuff... blah blah blah

dont_blame_nrpe=DONT_BLAME_NRPE

# more stuff... blah blah blah

ifelse(DONT_BLAME_NRPE, 0,
        `command[check_tns]=do_what_i_want',
        `command[check_tns]=do_what_nrpe_allows');


If you're feeling really ambitious, you could even come up with a
makefile:

all: nrpe.cfg

nrpe.cfg: nrpe.cfg.m4
        m4 nrpe.cfg.m4 > nrpe.cfg




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list