Solved - still a bug but a different one; was Re: Possible bug in 3.0rc3

Tobias Klausmann klausman at schwarzvogel.de
Fri Feb 29 11:35:59 CET 2008


Hi! 

On Fri, 29 Feb 2008, Joerg Linge wrote:
> > Apparently, this line:
> > 
> > service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$
> 
> Works like a charm here with nagios 3.0rc3

I've found it after doing som rigorous debugging using
fopen/fprintf. I have to say that it's obscure and while Nagios
isn't at fault /per se/ (it does exactly what it's told to do),
it's a nast, nasty trap to fall into. It might be worthwhile to
consider fixing Nagios in this regard.

What happened was that I was playing around with different
settings for service_perfdata_file_template. In that process, I
ended up with this block of cfg file lines:

host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
# service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
# service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\
service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$

Can you spot the problem? If you do, congratulations, it took you
about six hours less than me. The problem is in the second to
last line: it ends with a \ - thus, logically, the following line
gets appended to it. Since the line containing the \ is a
comment, the last line vanishes entirely.

It might be a good idea to *not* interpret a \ at the end of
comment lines. 

Regards,
Tobias

-- 
"Have you any idea how successful censorship is on TV?
 Don't know the answer?  Hm.  Successful, isn't it?" -Max Headroom

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