handling of comments in config files
Jon Wilson
jon at netcraft.com
Wed May 21 18:51:03 CEST 2003
Hi,
Firstly, can I just say what a great bit of software Nagios is. We use it
here to monitor about 300 services on over 50 local, remote and virtual
hosts, and it has replaced a number of clunky and incompatible monitoring
scripts.
I've written a plugin which times the performance of a mysql SQL command.
It gets called something like this:
check_mysql_perf -H hostname -e 'select count(*) from foo;' -d mysql -w 10000 -c 20000
The -e flag specifies the SQL command to time, and the ';' character is
valid SQL.
Now, when the code in xmodtemplate.c reads this command in, it interprets
the ';' as "rest of this line is a comment". (I can work around this by
handling the ';' as needed inside the plugin). This happens in
xodtemplate.c, line 163:
/* skip blank lines and comments */
if(input[0]=='#' || input[0]==';' || input[0]=='\x0' || input[0]=='\n' || input[0]=='\r')
continue;
Could I suggest that the code (and the config file specification) be
ammended to allow escaping of literal comment characters in config values,
for example with \; and \#
(Oh, and another suggestion would be to have CVS $Id:$ tags inside the
source files. This helps when tracking down bugs by helping make sure
everyone is talking about the same version of the code.)
Thanks again for all the hard work,
Jon
--
Jon Wilson
Netcraft Ltd. Tel: +44 (0)1225 867975
jon at netcraft.com Fax: +44 (0)8700 517767
http://www.netcraft.com Mob: +44 (0)7776 137939
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
More information about the Developers
mailing list