Per-interface SNMP service check settings


We are looking into migrating from “Vanilla” Icinga2 to Director. In our Icinga2 configuration, hosts have an uplinks dictionary that does not only contain names, but also extra information about interfaces:

    GigabitEthernet0 => {
        counter64 => true
        kbps_down => 10000.0
        kbps_up => 10000.0
    GigabitEthernet1 => {
        counter64 => true
        kbps_down => 50000.0
        kbps_up => 50000.0

This is importanf for us, because hosts can have multiple uplinks with different speeds. This lets us configure snmp checks with different thresholds, and enable/disable 64bits counter per-interface.

apply Service for (iface_name => iface_details in host.vars.wans) {
    # ...
    vars.snmp_interface = iface_name
    vars.snmp_interface_64bit = iface_details.counter64
    vars.snmp_warn = 0.9*iface_details.kbps_down + "," + 0.9*iface_details.kbps_up
    vars.snmp_crit = iface_details.kbps_down + "," + iface_details.kbps_up
    # ...

However, Director only accepts arrays for apply rules so a direct migration is not possible… How can I make this work? I could probably workaround the 64-bit counter issue by setting it at host level, but thresholds must be per-interface. Of course there is also the option to hard code uplink1_xxx, uplink2_xxx, etc. at host level but this would defeat the purpose…

Any ideas?