Page 1 of 1

Service groups issue

Posted: Wed Feb 22, 2017 10:42 am
by as300182
I'm running Nagios Core 4.2.2.
I have a servicegroups.cfg file in the /usr/local/nagios/etc/objects folder which reads as follows:

Code: Select all

define servicegroup {      
       servicegroup_name NETWORKS 
       alias Network Loads 
       members dev,Network Load,aspcon,Network Load,aspent,Network Load
}
However, once I add the following to my service definitions

Code: Select all

       servicegroups                    NETWORKS
I get these errors when I try to restart Nagios.

Error: Could not find any servicegroup matching 'NETWORKS'
Error: Failed to process servicegroup names for service 'Network Load' on host 'dev'

If I remove the line from my service definition for 'dev', then I get the same error for one of the others. So it looks as if the servicegroups.cfg file is either not being read, or it has a syntax error of some description.

Can anyone help me resolve this please?

Re: Service groups issue

Posted: Wed Feb 22, 2017 5:31 pm
by tgriep
Did you add an entry in the nagios.cfg file like the example below so Nagios knows to look in the servicegroups.cfg file for those entries?

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/servicegroups.cfg
It sounds like it may be missing.

Re: Service groups issue

Posted: Thu Feb 23, 2017 3:13 am
by eltrasimaco
I dont really know what the default is, but I always add:

register 1

Re: Service groups issue

Posted: Thu Feb 23, 2017 12:50 pm
by tgriep
Where do you add the "register 1" to?
The template or the service check?

When you create a template, you should use

Code: Select all

register 0
That tells Nagios that the entry is a template and to not load it as an active check.

The service check itself should have

Code: Select all

resister 1
That tells Nagios that the entry an active check and runs it.

Re: Service groups issue

Posted: Tue Mar 28, 2017 6:55 am
by as300182
tgriep wrote:Did you add an entry in the nagios.cfg file like the example below so Nagios knows to look in the servicegroups.cfg file for those entries?

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/servicegroups.cfg
It sounds like it may be missing.
Many thanks. This fixed it. Totally forgot about registering the new servicegroups.cfg file in the nagios.cfg file. :oops:

Re: Service groups issue

Posted: Tue Mar 28, 2017 8:26 am
by tgriep
Your very welcome. Shall I close and lock up this post as solved?

Re: Service groups issue

Posted: Wed Mar 29, 2017 4:53 am
by as300182
Yes I'm happy for this one to be closed now. Thanks.