Page 1 of 1

Might have found a hostgroup bug...

Posted: Fri Jan 10, 2014 12:10 pm
by bdowne01
Hi guys,

Long time Nagios user here, and I tend to push the configuration with lots of shortcuts and tricks. However, I think I might've pushed too far and uncovered a bug :)

This is tested on Nagios Core 3.5.1.

How to reproduce:
Define a service template assigned to two or more hostgroups with any number of hosts contained within the host groups.

Code: Select all

define service {
    name    test-template
    register    0
    hostgroup_name    hostgroup1,hostgroup2
}
Elsewhere, define a service referencing the template, and attempt to negate hosts contained in *both* groups.

Code: Select all

define someservice {
   use  test-template
   host_name              !somegroup1host,!somegroup2host
   service_description   Just-fooling-around
   check_command    some_check!derp
}

The above does not work, the configuration check will fail saying it "cannot expand hosts". Even though via the register 0 entry should be applying to all hosts in both groups, trying to negate a service using the template with one "host_name" line containing hosts from *both* groups will fail. If you limit the host_name entries to one group *or* another, the configuration passes.

This looks like a bug to me. Can anyone else verify this behavior to ensure it's simply not something to do with my configuration technique?

Re: Might have found a hostgroup bug...

Posted: Fri Jan 10, 2014 12:48 pm
by abrist
Just to clarify, if you remove one of the hostgroups from the template, the host exclusions on the service work?

Re: Might have found a hostgroup bug...

Posted: Fri Jan 10, 2014 4:45 pm
by bdowne01
Yep, but only if the host remaining in the service exclusion is a member of the group left in the template definition.

Basically, using any of them in combination individually is fine... it's when you try to cross reference across host groups that the problem arises.

Re: Might have found a hostgroup bug...

Posted: Mon Jan 13, 2014 12:03 pm
by abrist
I am actually unsure if this is wia or not. It is definitely unexpected behavior though. Please open a bug report at: http://tracker.nagios.org