Services & Service Groups


#1

Hey,

I apologize if this is some obvious question, but I’ve looked through all the documentation and done some Google searching without much luck.

I think I might be getting confused on exactly how Services, Service Groups; Hosts & Host groups relate to each other.

From my (possibly incorrect) understanding. “Services” are activities which can be carried out to work out if something is wrong. These Services can be grouped into “Service Groups” - for example, you could have an “Internet Test” service group which does a test on resolving an IP, pinging another address and doing a tracert to something else again.

“Hosts” are the individual computers/devices which are to be checked. They can be grouped into “Host Groups” such as “Level3Datacentre” or “critical devices” so you can set rules to a variety of devices which are somehow logically or geographically grouped together.

Am I right so far?

So, what I want to do is create a “service group”, for example, lets call it “general”. This group should contain the services Uptime, CPU usage & memory utilization.

I would then want to be able to set a particular host, lets call it “server1” to do all the tests contained within “general”.

I have the urge to use something like:

[code]define host{
use windows-server ; Inherit default values from a template
host_name server1 ; The name we’re giving to this host
address 192.168.0.5 ; IP address of the host
servicegroup general
}

define servicegroup{
servicegroup_name general
alias Regular checks
servicegroup_members uptime,cpu-load,memory-usage
}[/code] However, such code doesn’t work (obviously as there is no “servicegroup” command in define host".) The pre-flight check & manual also both seem to suggest I have to designate a particular host with “servicegroup_members”… But this doesn’t make a great deal of sense, if I have 100 servers that I want to do identical tests, it doesn’t make sense to list each individual test 100 times. eg. [blockquote]server1,uptime,server2,uptime,server,uptime,server1,cpu-load,server2,cpu-load,server,cpu-load,[/blockquote] … , that would seem to suggest defeating the purpose of service groups all together.

How can I assign certain hosts to do all checks contained within a service group?

Thank you very much :slight_smile:

  • Alan

#2

Define the host independently of services or servicegroups. Then the services must be assigned to hosts. That is done by defining services. Then in the service definition you should put servicegroups variable if you want it to be a member of some servicegroup.

As you have already written and understood:
[blockquote](obviously as there is no “servicegroup” command in define host".) [/blockquote]
…you can only assign servicegroups to service definitions, not host definitions.

For this:
[blockquote]How can I assign certain hosts to do all checks contained within a service group?[/blockquote]
No way to do it like that, but you can do it like this:

define service{ host host1,host2,host3,...,hostN service_description service1 servicegroups servicegroup_name . . . }
…and so on for every other service. I think it’s the shortest way.

Hope that helps.


#3

ah, yes, makes sense. Thankyou :slight_smile:

Yup, that’s what I’m using now and it seems to work. Will be a little annoying to maintain, but Nagios seems awesome enough to make it all worth it :slight_smile:

Cheers,

  • Alan

#4

I have to agree this doesn’t make much sense… nagios has beautiful grouping and inheritance there should be some way to say:

Define services http, https, ping (services)
Web servers have http, https, ping attached to them (servicegroup webserver)
The following hosts are webservers (hostgroup)

Doesn’t this seem a logical organization? Why even have the hostgroups and servicegroups if you can’t link them together? What if I wanted to add a tomcat port to webeservers I have to go in and find every webserver and add that host?

I should be able to define “webservers” hostgroup and then simply attach tomcat service into the servicegroup webserver which is already attached to these hosts no?