Line continuations not working as expected

Matthew Richardson matthew-ln at itconsult.co.uk
Mon Dec 31 18:16:02 CET 2007


Sorry folks, I thought I had checked this before sending the message, but
had done it wrong.

The issue is the difference between Unix & Windows line ends in the config
files.

Using a "\" to end a line terminated with Unix line end, Nagios correctly
treats the subsequent line as a continuation.

Unfortunately if a Windows line end (CRLF) follows the "\", Nagios does not
treat the line as a continuation.

Because of the way I use a Windows PC, almost all of my Nagios config files
have Windows not Unix line ends.  Apart from this issue, I have had no
problems.

Would it be possible to adjust the code so as to allow continuations with
either type of line end?

Best wishes,
Matthew

 ------
>From: Matthew Richardson <matthew-ln at itconsult.co.uk>
>To: nagios-devel at lists.sourceforge.net
>Cc: 
>Date: Mon, 31 Dec 2007 17:06:39 +0000
>Subject: [Nagios-devel] Line continuations not working as expected

>I have just tried the config:-
>
>|define host{
>|	use			template-host-generic,connectivity
>|       host_name               connectivity_test1
>|       alias                   connectivity_test1
>|	check_interval		1
>|       check_command           check_cluster_test1!\
>|$SERVICESTATEID:connectivity_test1:ping1$,\
>|$SERVICESTATEID:connectivity_test1:ping2$,\
>|$SERVICESTATEID:connectivity_test1:ping3$\
>|!1
>|        address                 nohost.itconsult.net
>|        }
>
>in order to assemble a very long check command in a readable way (the real
>one will be much longer than the test!).
>
>However it fails thus:-
>
>|Nagios 3.0rc1
>|Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
>|Last Modified: 12-17-2007
>|License: GPL
>|
>|Reading configuration data...
>|
>|Error: Invalid host object directive '$SERVICESTATEID:connectivity_test1:ping1$,\'.
>|Error: Could not add object property in file '/etc/nagios/connectivity/test1.cfg' on line 16.
>|
>|***> One or more problems was encountered while processing the config files...
>
>Am I doing something stupid, or is this a bug with the new line
>continuation feature?
>
>The config works fine with the command in one long line...
>
>Best wishes,
>Matthew
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Microsoft
>Defy all challenges. Microsoft(R) Visual Studio 2005.
>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>_______________________________________________
>Nagios-devel mailing list
>Nagios-devel at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/nagios-devel


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list