Integrate automatically new Hosts in Map with Director


#1

Hello,

i have a little problem with the automatically adding new Hosts in Maps.
I have configured the automatically rollout how it is explained in the following example https://www.icinga.com/2017/08/16/integrate-maps-into-icinga/

My Problem know is how I can add the needed code

 var loc = getHostGeoLocation(name)
 if (loc) {
    vars.geolocation = loc
  }

with the Icinga Director?

Whenn I copy the code in the gerneric group, after the next reload from Icinga2 the code is overwritten, that is normal. But with the Datafields and Lists I dont know how I can realize the Problem.
Has anyone an idea for that Problem?


#2

That’s not possible with the Director, you can only do this inside the Icinga 2 DSL in static configuration files. The Director does not support inlining DSL code like functions or conditions.