Page 1 of 1

Servicegroup Negate

Posted: Thu Jun 12, 2014 8:35 pm
by BanditBBS
Wanted to create a static config file and define a servicegroup in it, like so:

Code: Select all

define servicegroup{
         servicegroup_name non_system
         alias everything except system
         members *
         servicegroup_members !system
}
What the end result is, I want every service to belong to this servicegroup EXCEPT the services that belong to "system" servicegroup. When I verify it says

Code: Select all

Error: Could not find member group '!system' specified in servicegroup 'non_system' (config file '/usr/local/nagios/etc/static/non_system.cfg', starting on line 1) 
I get the same thing if I instead try and ! the individual services. I know I could go through and add every defined service to the service group I want, but I would rather it be automatic like I was trying. When the datacenter isn't primary they want to disable notifications for all services in this new service group. Can anyone think of what I am doing wrong or suggest another method. From what I am seeing, doesn't look like you can use ! in servicegroup definitions.

Re: Servicegroup Negate

Posted: Thu Jun 12, 2014 10:44 pm
by Box293
Have a read of this thread and see if it helps your cause.

http://support.nagios.com/forum/viewtop ... =7&t=25137

Re: Servicegroup Negate

Posted: Thu Jun 12, 2014 10:49 pm
by BanditBBS
Box293 wrote:Have a read of this thread and see if it helps your cause.

http://support.nagios.com/forum/viewtop ... =7&t=25137
Box, that thread is saved in my favorites, it's one I refer to often and what gave me the idea I had in this case. It works fine with services and hosts, but not when trying to exclude services or servicegroups from a servicegroup. As I said in the opening post, it is like the servicegroup definition doesn't obey the ! and thinks it is part of the service or servicegroup name and errors out.

Thanks for the input though!

EDIT: Actually, after I read it further, that isn't the thread i have saved, but same content, lol

Re: Servicegroup Negate

Posted: Thu Jun 12, 2014 11:44 pm
by Box293
Yeah I get what you're saying.

I just went and had a play in Core 4.x and 3.5.x and it seems the same behaviour is exhibited there. It does not look like you can perform exclusions in servicegroups or hostgroups.

Also, I found in servicegroups you cannot have members with the * wildcard. You need to specify host,service in pairs. You can use a wildcard for the service though. Example:

Code: Select all

members                 E4300,*,Test CentOS,*,localhost,*

Re: Servicegroup Negate

Posted: Fri Jun 13, 2014 8:37 am
by BanditBBS
I just went and edited all but one template and added the service group to them. It wasn't too bad, luckily only have about 35 templates.

Feel free to close this up and/or to tell me what I was doing wrong :|