Service groups issue

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
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Service groups issue

Post 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?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Service groups issue

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
eltrasimaco
Posts: 75
Joined: Thu Aug 02, 2012 7:15 am

Re: Service groups issue

Post by eltrasimaco »

I dont really know what the default is, but I always add:

register 1
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Service groups issue

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Re: Service groups issue

Post 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:
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Service groups issue

Post by tgriep »

Your very welcome. Shall I close and lock up this post as solved?
Be sure to check out our Knowledgebase for helpful articles and solutions!
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Re: Service groups issue

Post by as300182 »

Yes I'm happy for this one to be closed now. Thanks.
Locked