Import custom variables / datafields with director sync rule

I am quite happy with icinga, director and its flexibility!

Currently I am stuck with following problem:

The sync rule allows to select the destination attribute " All custom vars".
I need to import a hole bunch of service checks (13k) of different(!) kind => I do have different custom vars (i.e. the attributes of the different service templates those checks import).

I thought and I am desperately hoping for a way to accomplish the following (using fileshiper with Excel):

Everything works like a charm except the part with “customvar1=valuex;customvar2=valuex”.
No matter how I try to handle a list of custom vars within ONE Column - its not working in the intended way.

Tried to do split during import (with delimiter char ‘;’) and stuff the result in an array - but this only leads to vars[“0”]= “customvar1=valuex” etc. on the resulting service.

I would like to avoid defining columns for every custom var and making different import/syncrules for every type of service-template to be imported.

Is there a possibility to have ONE column with AV-Pairs to get converted to "vars. = " ?

“customvar1=valuex;customvar2=valuex” should become:

var. customvar1=valuex
var. customvar2 =valuex

To use the “All custom vars” it has to be a JSON structure, if I remember correct. I have not used it to build the configuration by hand, but for LConf-Migration and with a database import providing JSON.

a good hint - thx ! But if I try this:

I get this:

vars[“0”] = “{ dns_expected_answers: “” }”

I hoped for vars.dns_expected_answers=

Now I try to create LCONF Style + Modifier “Create LCONF → Hash” - who knows :slight_smile:

Frustrating - I think I don’t get it sigh

used [ “_dns_expected_answers” ]


but got


In total despair I took the sample from here Platz da LConf, der Director kommt! | NETWAYS GmbH

"_operatingsystem Linux",
"_role Webserver",
"_rack Rack01"

and got this:


How does the input for a director sync-rule have to look like to be processable by “All custom vars” - I am to silly or blind (or both) to figure it out.

Now I found some time to test.

JSON-Format was already correct, but then a modifier of type “Decode a JSON string” is required.

With this I got form a csv like this:


Two host like this:

object Host "linux" {
    import "Default Host"

    vars.description = "good"
    vars.os = "Linux"

object Host "windows" {
    import "Default Host"

    vars.description = "bad"
    vars.os = "Windows"

This did it - thank you very much. “Decode a JSON string” sounds very logical :slight_smile: - don’t know how I could oversee this. Sometimes there is a certain point reached that could be described as “desperate subtle aggressive cognitive disability” :).

Thanks again for your effort!

1 Like