Service Groups - Simple definition?

An open discussion forum for obtaining help with Nagios Core.

Service Groups - Simple definition?

Postby chrisjx » Mon May 14, 2012 7:55 pm

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

Re: Service Groups - Simple definition?

Postby agriffin » Wed May 16, 2012 10:17 am

I'm exactly sure what you're asking, but this is the way you would group related services from different hosts.
agriffin
 
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Service Groups - Simple definition?

Postby chrisjx » Wed May 16, 2012 2:06 pm

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

Re: Service Groups - Simple definition?

Postby agriffin » Wed May 16, 2012 2:39 pm

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.
agriffin
 
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Service Groups - Simple definition?

Postby bahjaat » Tue May 29, 2012 4:40 am

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!
bahjaat
 
Posts: 3
Joined: Tue May 29, 2012 4:30 am

Re: Service Groups - Simple definition?

Postby agriffin » Wed May 30, 2012 9:29 am

Glad it worked out!
agriffin
 
Posts: 876
Joined: Mon May 09, 2011 9:36 am


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 1 guest