hostgroup_name override not working service?

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
joehayden
Posts: 2
Joined: Wed Apr 17, 2013 9:20 am

hostgroup_name override not working service?

Post by joehayden »

Hello,

New Nagios user here with an override question. For reference, I am using Nagios 3.2.0. I am trying to do a ping check override for different host groups. Here is an example that isn't working as expected:

define service {
use generic-service
service_description Ping Check
check_command check_ping!32,80%!40,90%
host_name *
}

define service {
use generic-service
service_description Ping Check
check_command check_ping!180,80%!200,90%
hostgroup_name apc-devices

I want all hosts to test ping with the 32,80!40,90 parameters except for the hosts defined in the apc-devices host_group. These should use the 180,80!200,90 parameters. The actual behavior is that the apc-devices are using the 32,80!40,90 parameters. In effect, the override isn't working. Am I doing something wrong or is this not supported?

Thanks
Joe
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: hostgroup_name override not working service?

Post by abrist »

It all depends on the order the configs are loaded. The check has the same name, so whichever one is loaded last will take precedence, overwriting the other. You can check which one is applying by searching through the objects.cache file

Code: Select all

more /usr/local/nagios/var/objects.cache
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.
joehayden
Posts: 2
Joined: Wed Apr 17, 2013 9:20 am

Re: hostgroup_name override not working service?

Post by joehayden »

Thanks for the reply. I checked the objects.cache file as you suggested and as expected the apc-devices are using the first set of parameters. No surprise as this reflects the problem that I am seeing.

The examples I provided are in the same config file in the same order that I listed them so I would expect the second to override the first. This is working great when I use a host_name to override a previously define command applied to a host_group but it is not working when I specify a host_group to override a previously define command applied to a host_group.

Can anyone confirm or deny that what I am attempting to do is supported?

Thanks!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: hostgroup_name override not working service?

Post by scottwilkerson »

joehayden wrote:Can anyone confirm or deny that what I am attempting to do is supported?
There may be certain scenarios where this will work, but as a whole I would say it is unsupported and will likely throw warnings of duplicate definitions when verifying your configuration.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked