Am 04.11.2016 um 23:17 schrieb Michael Martinez:

Hi Michael,

> Hi Stephan,
>
> Yes, in fact this is how I ended up solving it, with the "apply
> Service for" as you say.
> Here is how our host attributes look in our inventory system:
>
> vars.check_saltminion = "True"
> vars.nrpe.check_cpu_stats = { }
> vars.nrpe.check_total_procs = { }
> vars.nrpe.check_redis_process = { max_check_attempts = 2,
> alert_contact = [ "mmartinez", "TaosTest"], slack_channel =
> "sre-alerts", notify_by_email = "true", notify_by_victorops = "true" }
> vars.nrpe.check_ssh = { }
>
> It works.
>
> Now I've run into a new problem. Within the service definition:
> apply Service "nrpe" for (checkname => config in host.vars.nrpe) {
> .....
> }
> I have a statement where I iterate through all hosts with
> "for (h in get_objects(Host)"
> Within this for statement I need to check if the host "h" has the
> variable vars.nrpe.<checkname>. For example, if checkname is
> "check_redis" then I need to check for the existence of
> h.vars.nrpe.check_redis.
>
> How to do this?

Honestly, I don't get what you try to achieve? Do you want to create a
service if vars.nrpe.check_redis exists? The apply for rule already does
that?! What am I missing?

Best regards,
Stephan
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to