[Nagiosplug-devel] Patch for leading whitespace on comments

Ton Voon ton.voon at altinity.com
Fri Jan 19 13:54:48 CET 2007


Sorry Tobias, wrong mailing list. You want nagios-devel.

On 19 Jan 2007, at 12:25, Tobias Klausmann wrote:

> Hi!
>
> As of 2.6, Nagios recognizes leading whitespace only in the main
> config file. The attached patch fixes this.
>
> To illustrate, this piece of config does not work currently:
>
> define host {
>     host_name                 eric.schwarzvogel.de
>     alias                     eric.schwarzvogel.de
>     address                   194.97.4.250
>     #check_command             check_host_alive
>     check_command             check_host_new
>     max_check_attempts        3
>     retain_status_information 1
>     contact_groups            Privat Klausmann
>     notification_interval     30
>     notification_period       24x7
>     notification_options      d,u,r
>     passive_checks_enabled    1
> }
>
> The reason is the commented-out check_command line. It would work
> like this:
>
> define host {
> ...
> #   check_command             check_host_alive
>     check_command             check_host_new
> ...
> }
>
> This is because (for non-main config files), Nagios first checks
> if the first char is "#" and *then* strips the line. For the main
> config file, this happens the other way around.
>
> I've attached a patch that makes this behaviour more consistent.
> I believe the check for '\0', '\n' etc. could be simplified to,
> *if* strip() removes some of the chars. I tried to be
> non-invasive as possible, so I didn't do that.
>
> I'd like it if this patch makes it into the 2.x series.
>
> Regards,
> Tobias


http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20070119/8cc89568/attachment.html>


More information about the Devel mailing list