2009/4/9 Edward Trochim <ejtroc...@alaska.edu>: > I have a service template that specifies several host groups and one > host to check. One of the services that inherits this template should > not be executed by one of the host groups defined. I read the object > tricks documentation page and found that I could include a ! before > the name in a hostgroup_name definition in the service definition to > exclude that hostgroup from that service. However, when I do that > nagios excludes all hostgroups from the list from running that service. > > That explanation of the problem might be a little thick so here is an > abbreviated example. > > I have a service template like this: > > define service{ > name standard-check > use generic-service > hostgroup_name hostgroup1, hostgroup2, hostgroup3,\ > hostgroup4, hostgroup5, > hostgroup6,\ > hostgroup7 > host_name host1 > servicegroups standard_checks > register 0 > } > > And a service definition like this. I want to exclude hostgroup5 from > this one service definition: > > define service{ > use standard-check > hostgroup_name !hostgroup5 > service_description Disk Space > } > > Instead of doing what I want this excludes every hostgroup defined in > the template. host1 still gets the service though. > > I am currently running nagios version 3.0.6. > > Is this a bug in nagios or am I misunderstanding the way this should > behave? > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Nagios-users mailing list > Nagios-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nagios-users > ::: Please include Nagios version, plugin version (-v) and OS when reporting > any issue. > ::: Messages without supporting info will risk being sent to /dev/null >
The line "hostgroup_name !hostgroup5" will completely supercede anything previously specified for hostgroup_name in the template. If you want it to be processed as an addition to what was in your template, you need to prefix the list with a "+". So in your service definition, you need to put: hostgroup_name +!hostgroup5 I've only ever used this syntax myself for specifying additional contacts, but I guess the logic would be the same for hostgroups too. Give it a try anyway and come back if it doesn't work. I assume you're using Nagios 3. I don't think use of "+" in this way was possible in version 2. Cheers, Jim ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null