Hi Sander,

On 23.02.2015 13:02, Sander Hoentjen wrote:
> First let me explain my goal:
> 
> I have a host, which has an array with lots of items. For each item I
> want 2 service checks, and the second service check should depend on the
> first service check.
> 
> I have this weorking fine, except the dependency thing.
> 
> 
> So what do I have:
> 
> 
> apply Service "service_a " for (thing in host.vars.things) {
>   import "generic-service"
> 
>   check_command = "check_a"
>   check_interval = 10m
>   retry_interval = 10m
>   vars.thing = thing
>   assign where host.vars.things != null
> }
> apply Service "service_b " for (domain in host.vars.things) {
>   import "generic-service"
> 
>   check_command = "check_b"
>   check_interval = 10m
>   retry_interval = 10m
>   vars.thing = thing
>   assign where host.vars.things != null
> }
> 
> 
> So to add the dependency I figured I need to add something like the
> following:
> 
> 
> apply Dependency "dep_a_b" for (thing in host.vars.things) to Service {
>   parent_service_name = "service_a " + thing
> 
>   assign where service.check_command == "check_a"
> }
> 
> 
> This does not work however, because "thing" is not defined according to
> icinga
> 
> 
> I hope anyone can help me out here :)

I guess you want to set a dependency service_a_X -> service_b_X ?

How about:

apply Dependency "dep_a_b" to Service {
  parent_service_name = "service_b " + service.vars.thing

  assign where match("service_a*", service.name) && service.vars.thing
!= null
}

Cheers
Markus Frosch
-- 
[email protected]
http://www.lazyfrosch.de

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to