Service Groups - Simple definition?

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
chrisjx
Posts: 3
Joined: Mon May 14, 2012 7:44 pm

Service Groups - Simple definition?

Post by chrisjx »

It seems that I would use service groups to see a given service on all the remote hosts where it is running.

This works...

Code: Select all

define servicegroup {
	servicegroup_name	mysnmp
	alias			My SNMP Service Group
	members			com.xyz.dev.aaa,My Basic SNMP,com.xyz.dev2.aaa,My Basic SNMP
}
But that is extremely tedious.

I was thinking I could do something like this...

Code: Select all

define servicegroup {
	servicegroup_name	mysnmp
	alias			My SNMP Service Group
	members			*.dev*,My Basic SNMP
}
and it would create a group that includes all me dev hosts.

I have the regex flag set, and I've created lots of hostgroups.

I guess I'm not even sure if this is how to accomplish the idea of seeing, for example, the Disk stats of all my remote hosts.

Any tips would be very much appreciated.

Thanks,
Chris.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Service Groups - Simple definition?

Post by agriffin »

I'm exactly sure what you're asking, but this is the way you would group related services from different hosts.
chrisjx
Posts: 3
Joined: Mon May 14, 2012 7:44 pm

Re: Service Groups - Simple definition?

Post by chrisjx »

Sorry for the ambiguous post.

I can't seem to find a way to set up the second approach that uses a simple regex approach to defining service groups. When I test it, it always chokes.

Right now I've got about 45 computers that I'm tracking. It seems it would be bordering on the ridiculous to define the service groups the long way...

<host1>,<service description1>, <host2>,<service description1>,<host3>,<service description1>,<host4>,<service description1>, and on and on...

I'm looking for the definitive approach to using regex to associate each service with a hostgroup name.

This is a typical host group definition:

Code: Select all

define hostgroup{
        hostgroup_name  comm          ; The name of the hostgroup
        alias           Communications  		   ; Long name of the group
        members        comm*
        }
Typical service definition:

Code: Select all

define service{
		use generic-service 
		hostgroup_name comm
		service_description OS SNMP
		check_command check_nrpe!check_snmp 
}
Then defining a service group:

Code: Select all

define servicegroup {
	servicegroup_name	snmp_ecm
	alias			Std_SNMP
	members			comm,OS SNMP
}
Chokes with:

Code: Select all

Error: Could not find a service matching host name 'comm' and description 'OS SNMP check_snmp' (config file '/usr/local/nagios/etc/servers/_service_groups.cfg', starting on line 9)
I've tried putting the regex approach in the servicegroup definition, like comm*, but to no avail. So it always seems Im back to a LOT of tedious typing and tedious changes if I have to hard code all the definitions.

Is this a mostly unused feature; service groups?

How are others looking at, for example, all disk drives across specific host groups, or across all groups?

Thanks for any leads or tips,
Chris.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Service Groups - Simple definition?

Post by agriffin »

I see. The way I would do this is by leaving the members option alone in the service group definition. I would instead use the servicegroups option in each service definition or in a template used by those services.
bahjaat
Posts: 3
Joined: Tue May 29, 2012 4:30 am

Re: Service Groups - Simple definition?

Post by bahjaat »

agriffin wrote:I see. The way I would do this is by leaving the members option alone in the service group definition. I would instead use the servicegroups option in each service definition or in a template used by those services.
Nice one, I did this and it works out for me. Thanks!
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Service Groups - Simple definition?

Post by agriffin »

Glad it worked out!
Locked