Hi, I'm slowly migrating from nagios/nrpe to icinga/nrpe to icinga/master-satellite, I have one icinga "master" and all servers are in their own zone and are their own endpoints. Right now, all the satellites have the same zone.conf (NodeName and ZoneName are defined in constants.conf) ------- object Endpoint "icinga.example.com" { host = "icinga.example.com" port = "5665" }
object Zone "master" { endpoints = [ "icinga.example.com" ] } object Endpoint NodeName { } object Zone ZoneName { endpoints = [ NodeName ] parent = "master" } object Zone "global-templates" { global = true } --------- And then, the master has a very repetitive zones.conf: -------- object Endpoint NodeName { } object Zone ZoneName { endpoints = [ NodeName ] } object Zone "global-templates" { global = true } object Endpoint "host2.example.com" { } object Zone "host2.example.com" { endpoints = ["host2.example.com"] parent = "master" } object Endpoint "host5.example.com" { } object Zone "host5.example.com" { endpoints = ["host5.example.com"] parent = "master" } object Endpoint "host3.example.com" { } object Zone "host3.example.com" { endpoints = ["host3.example.com"] parent = "master" } -------- I am wondering if there could be a way to get the zone and endpoint genrerated somehow. I tried refactoring things with: var zones = [ "host2.example.com", "host3.example.com", "host5.example.com" ] apply Endpoint for (z in zones) { } apply Zone for (z in zones) { endpoint = [z] parent = "master" } but for some reason: "critical/config: Error: 'apply' cannot be used with type 'Zone'" I then tried another approach, using a for loop, something like: for (z in zones) { object Endpoint z {} object Zone z { endpoints = [ z ] parent = "master" } } but this spits: "critical/config: Error: Error while evaluating expression: Tried to access undefined script variable 'z'" } I then tried to do the for loop myself, and do object instantiation, like, for (z in zones) { zz = Zone() ze = Endpoint() } But I could not figure out what field to fill in with what, and I stopped before loosing more time :-) So, as I have a few hundreds servers to continue migrating, I was wondering if there was an easy way for me to do this (or if I have to have some external script generate the zones.conf) -- Mathieu Arnold _______________________________________________ icinga-users mailing list icinga-users@lists.icinga.org https://lists.icinga.org/mailman/listinfo/icinga-users