# Service rule with labled interfaces

**URL:** <https://community.icinga.com/t/service-rule-with-labled-interfaces/10205>\
**Category:** Icinga Director\
**Tags:** data-fields, array\
**Created:** [July 19, 2022, 12:17pm UTC](https://community.icinga.com/t/service-rule-with-labled-interfaces/10205 "2022-07-19T12:17:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_K](https://community.icinga.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@Marco\_K](https://community.icinga.com/u/Marco_K)\
**Post date:** [July 19, 2022, 12:17pm UTC](https://community.icinga.com/t/service-rule-with-labled-interfaces/10205/1 "2022-07-19T12:17:02Z")

</div>

Hello all,  
I am in the process of converting our Icinga from cofiguration files to director.  
I have a service rule here that I can’t get converted.

```auto
apply Service "Iftraffic: " for (int => config in host.vars.int){
        import "generic-service
        check_command = "check_iftraffic"
        vars += config
        assign where host.vars.int
}

```

In the host file this is then used as follows.

```auto
object Host "sw-01" {
        import "generic-host

        address = ""
        zone = "master"
        vars.hostgroup = "prod-net"

        vars.int["to-sw-02"] = {
                int = "TenGigabitEthernet1/0/1"
        }

        vars.int["to-sw-03"] = {
                int = "TenGigabitEthernet1/0/2"
        }

        vars.int["ro-host-01"] = {
                int = "TenGigabitEthernet1/0/3"
        }
}

```

In my Grafana dashboard, I then have a digram for each interface.  
I have already seen the example with the interface array in the documentation and tried it out.

However, with the previous solution, I like that I can add labels to the interfaces which makes for a better overview.

Can this also be replicated in the Director?

Greetings  
Marco

---

<div class="post-metadata">

**Author:** ![MarcusCaepio](https://community.icinga.com/user_avatar/community.icinga.com/marcuscaepio/32/287_2.png) [@MarcusCaepio](https://community.icinga.com/u/MarcusCaepio)\
**Post date:** [July 20, 2022, 8:40am UTC](https://community.icinga.com/t/service-rule-with-labled-interfaces/10205/2 "2022-07-20T08:40:07Z")

</div>

Maybe this doc helps ? [icingaweb2-module-director/15-Service-apply-for-example.md at master · Icinga/icingaweb2-module-director · GitHub](https://github.com/Icinga/icingaweb2-module-director/blob/master/doc/15-Service-apply-for-example.md)  
Don’t have a better tip right now, because I don’t use the director ^^

---

<div class="post-metadata">

**Author:** ![moreamazingnick](https://community.icinga.com/user_avatar/community.icinga.com/moreamazingnick/32/7725_2.png) [@moreamazingnick](https://community.icinga.com/u/moreamazingnick)\
**Post date:** [July 20, 2022, 2:54pm UTC](https://community.icinga.com/t/service-rule-with-labled-interfaces/10205/3 "2022-07-20T14:54:09Z")

</div>

you could write a wrapper script for check\_iftraffic that executes check\_iftraffic for each interface, and with this option there is just one service
