On Thu, Nov 3, 2016 at 2:11 PM, Stephan Tesch <step...@tesch.cx> wrote: > Am 03.11.2016 um 19:39 schrieb Michael Martinez: > 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) {
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? _______________________________________________ icinga-users mailing list icinga-users@lists.icinga.org https://lists.icinga.org/mailman/listinfo/icinga-users