Am 03.11.2016 um 19:39 schrieb Michael Martinez:

Hi Michael,

> I need some help figuring out a solution. I've got  a bunch of Host
> objects, each one contains attributes that define which nrpe checks
> should be performed, like this:
>
> object Host "yyy" {
>    vars.nrpe.check_foo.max_check_attempts = 1
>    vars.nrpe.check_foo.alert_contact = sre
>    vars.nrpe.check_foo.check_interval = 5m
>
>    vars.nrpe.check_oof.max_check_attempts = 3
>    vars.nrpe.check_oof.alert_contact = atlantic
>    vars.nrpe.check_oof.check_interval = 10m
> }

I'm not sure, but would this be the same config as (which I find more
readable):

object Host "yyy" {
  vars.nrpe["check_foo"] = {
    max_check_attempts = 1
    alert_contact = sre
    check_interval = 5m
  }
  vars.nrpe["check_oof"] = {
    ...
  }
}

If so, you could use the following:

apply Service "nrpe" for (nrpe => config in host.vars.nrpe) {
  import "generic-service"
  check_command = "nrpe"
  vars.nrpe_command = nrpe
  vars += config
}


> Here "check_foo" and "check_oof" are the names of two different nrpe
> commands that should be run on this host, and the sub-variables are
> parameters that the service should use.
>
> I would like Icinga to create a Service for each different check
> command and apply it to the host. I am stumped as to how to do this.
> Any suggestions?
I hope I understood your question correctly :)

Best regards,
Stephan

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to