Chage params for several services assigned to hostgroup


#1

Hello!
I have a lot of services assigned to hostgroups. How can I change, say, notification/check period for these services for only some hosts but not for entire hostgroup?


#2

define two different templates and assign them :slight_smile:

nagios.sourceforge.net/docs/3_0/ … tance.html


#3

Templates for what? And how to use them?
I have
hostgroup1: h1, h2, h3, h4, h5
service1 -> hostgroup1
I need to change notification_period for service1 on h3 and on h4. ( :!: not for host notification, but for service notification)
How to use templates and accomplish this?


#4

If you already use hostgroups it shouldn’t be too difficult, and reading the docs i linked would be a good starting point :slight_smile:


#5

OK, ok. I’ve red all this documents and the only reason I’m asking for help here is that I didn’t managed to find answer to my question in documents.
Could you provide me with short example how to accomplish that?
Yepp, I have hostgroup with many hosts. I have a service which belongs to this group. I have several hosts for which I want to change service settings. If I’ll change my service then it will affect service on all hosts of this group. AFAIK I can’t change settings for service in host definition.
So I’m waiting for more detailed explanation of your idea.

Thanks!


#6

can’0t access my server now… but something like this should work

define service {
name template1
nortification_period 1
register 0
}

define service {
name template2
nortification_period 2
register 0
}

in the services which need notification period 2 put the line
use template2

in the others put use template1

when you need to change the timings you can change the timing only in the template.

*Check for correct definitons in the docs, i’m going from memory here.


#7

I suspect you didn’t understood my question properly. Please read once more. I don’t have two services. I have only one service assigned to hostgroup. This hostgroup includes several dozens of hosts. I don’t want to create service for each host but instead create one and attach it to hostgroup. Do you understand this approach now?


#8

you can’t have a single service with a single definiiton with different parameters on different hosts.
you need to associate each host with a service template.


#9

For people who also need a solution for a problem like mine:
you can use:[code]
define service{
use template
hostname !h3,!h4
hostgroup_name hostgroup1
service_description service1
check_command ckeck_load!3,2,1!4,3,2
}

define service{
use template
hostname h3,h4
service_description service1
check_command ckeck_load!3,2,1!4,3,2
check_period workhours
}
[/code]