nagios -v not counting all warnings
nap
naparuba at gmail.com
Wed Dec 30 19:21:48 CET 2009
It's not a Warning for duplicated service if one was apply on host and
the other on hostgroup. The host service ovveride the other. This must
be a notice, not a Warning.
Jean
On Wed, Dec 30, 2009 at 6:33 PM, Ton Voon <ton.voon at opsera.com> wrote:
> Hi Jim,
>
> On 21 Dec 2009, at 15:59, Jim Avery wrote:
>
>> define service
>> host_name test
>> use generic-service
>> service_description test
>> check_command check_dummy!0 "test always succeeds"
>> }
>> define service
>> host_name test
>> use generic-service
>> service_description test
>> check_command check_dummy!0 "test always succeeds"
>> }
>
> Thanks. This is basically just a service duplicated.
>
>>
>> When I run nagios -v against a nagios.cfg which reads this config, I
>> get:
>>
>> Warning: Duplicate definition found for service 'test' on host
>> 'test' (config file '/usr/local/nagios/etc/objects/test/services.cfg',
>> starting on line 1)
>>
>> which is fair enough as the service is indeed defined twice, but in
>> the totals at the end I get:
>>
>> Total Warnings: 0
>> Total Errors: 0
>>
>> Note this behaves the same whether the second service is defined using
>> directive "host_name test" or "hostgroup_name test".
>
> I've got a minimal config that causes this error, and as you say, it
> prints a warning but then just continues.
>
> Looking through the code, it is setting up skip lists for the objects,
> but doesn't correctly propagate errors back up. The specific change I
> made is this:
>
> @@ -5264,7 +5269,7 @@ int xodtemplate_duplicate_services(void){
> #ifdef NSCORE
> logit(NSLOG_CONFIG_WARNING,TRUE,"Warning:
> Duplicate definition found for service '%s' on host '%s' (config file
> '%s', starting on line %d)\n",temp_service
> #endif
> - result=ERROR;
> + return ERROR;
> break;
> case SKIPLIST_OK:
> result=OK;
>
>
>
> The result=ERROR was getting changed by the next loop through the list
> of services. Changing to a return now errors from the nagios -v with
> the message:
>
> # Read main config file okay...
> # Processing object config file '/Users/tonvoon/git/nagios/t/etc/
> duplicated-services.cfg'...
> # Warning: Duplicate definition found for service 'Dummy service' on
> host 'host1' (config file '/Users/tonvoon/git/nagios/t/etc/duplicated-
> services.cfg', starting on line 12)
> # Error processing object config files!
> #
> #
> # ***> The name of the main configuration file looks suspicious...
> #
> # Make sure you are specifying the name of the MAIN configuration
> file on
> # the command line and not the name of another configuration
> file. The
> # main configuration file is typically '/usr/local/nagios/etc/
> nagios.cfg'
> #
> # ***> One or more problems was encountered while processing the
> config files...
> #
> # Check your configuration file(s) to ensure that they contain
> valid
> # directives and data defintions. If you are upgrading from a
> previous
> # version of Nagios, you should be aware that some variables/
> definitions
> # may have been removed or modified in this version. Make sure
> to read
> # the HTML documentation regarding the config files, as well as the
> # 'Whats New' section to find out what has changed.
>
>
> This function doesn't contain warnings/errors counters, so it is not
> straightforward to just increment the counters and continue.
>
> So the question becomes: should, in the case of this duplicated
> object, nagios -v fail completely? All the current tests pass expect
> for this case. My feeling is yes since there is something
> fundamentally wrong in your configuration if you have duplicated
> objects (which is the "right" one for Nagios to use?).
>
> Ton
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> 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 the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
More information about the Developers
mailing list