Might have found a hostgroup bug...

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bdowne01
Posts: 2
Joined: Fri Jan 10, 2014 11:57 am

Might have found a hostgroup bug...

Post 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?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Might have found a hostgroup bug...

Post by abrist »

Just to clarify, if you remove one of the hostgroups from the template, the host exclusions on the service work?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
bdowne01
Posts: 2
Joined: Fri Jan 10, 2014 11:57 am

Re: Might have found a hostgroup bug...

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Might have found a hostgroup bug...

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked