[Kapacitor] Sideload nested data and dynamic variables in tag/field names

Hi there,
I’m new to the TICK-Stack, evaluating the possibilities for our project. Right now I have a problem with the Kapacitor/tickScript. I need to load additional parameters into my alerts so i am using sideloads. The problem is, that my setup is very large, about 40.000 objects. So creating a sideload-file for every object would be a massive impact on inodes. I would like to group the object into bundles (host-file with infos for hosts and the hosts services). But i am stuck on a few attempts i have tried so far:

Imagine this tickScript:

dbrp "telegraf"."autogen"

stream
    |from()
        .measurement('nagios_state_check_icmp')
        .where(lambda: "host" == '1234')
    |sideload()
        .source('file:///scripts/sideload')
        .order('{{.host}}.yml')
        .tag('maintenance', 'FALSE')
    |alert()
        .crit(lambda: int("state") > 0 AND "maintenance" == 'FALSE')
        .log('/tmp/alerts.log')

Should be straight forward. Working for the host itself. But how to use this as a default script for all hosts and services?

1. nested yaml?

My first attempt was to create a nested yaml:

1234.yml
-------------------------------------
maintenance: false

services:
    5678:
        maintenance: true
    9012:
        maintenance: false

But i wasn’t able to parse it to get the nested value services->5678->maintenance.

Does the sideload support nested yaml? There are no examples in the documentation and it is not written anywhere (at least I couldn’t find it)

2. prefixed keys

Second approach was to use prefixed keys:

1234.yml
-------------------------------------
maintenance: false

5678_maintenance: true
9012_maintenance: false

But again, the .field() and .tag() methods of the sideload don’t seem to support templating to dynamically create the string from data-set parameters

.tag( '{{.service}}_maintenance' , 'FALSE')

So is the only possibility to create 40.000+ files or is there a trick I don’t know yet?

Okay, i have found out that nested yaml is supported with dot-Syntax:

services:
    5678:
        maintenance: true

is accessible through services.5678.maintenance.

Still the problem with the dynamic objectId exist… Any ideas about that?

Hi pyriand3r welcome !

Ths example will be helpful …

SideNode

Best regards