Ad Widget

Collapse

LLD net.if.discovery macro regular expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #1

    LLD net.if.discovery macro regular expression

    I'm trying to remove some interfaces from the LLD discovery used in "Linux network interfaces by Zabbix agent" template.
    For that, I'm adding some terms the "{$NET.IF.IFNAME.NOT_MATCHES}" macro.

    My monitored host's "net.if.discovery" key discover the following interfaces.

    Code:
    # zabbix_agentd -t net.if.discovery
    [
        {"{#IFNAME}":"spu_us_dummy"},
        {"{#IFNAME}":"sit0"},
        {"{#IFNAME}":"imq1"},
        {"{#IFNAME}":"eth7"},
        {"{#IFNAME}":"lo"},
        {"{#IFNAME}":"eth3"},
        {"{#IFNAME}":"br0"},
        {"{#IFNAME}":"bcmsw"},
        {"{#IFNAME}":"ifb1"},
        {"{#IFNAME}":"imq0"},
        {"{#IFNAME}":"eth6"},
        {"{#IFNAME}":"ppp0"},
        {"{#IFNAME}":"eth2"},
        {"{#IFNAME}":"ip6tnl0"},
        {"{#IFNAME}":"ifb0"},
        {"{#IFNAME}":"ip6gre0"},
        {"{#IFNAME}":"eth5"},
        {"{#IFNAME}":"eth1"},
        {"{#IFNAME}":"bcmswlpbk0"},
        {"{#IFNAME}":"dpsta"},
        {"{#IFNAME}":"imq2"},
        {"{#IFNAME}":"spu_ds_dummy"},
        {"{#IFNAME}":"eth4"},
        {"{#IFNAME}":"eth0"}
    ]
    I want to ignore interfaces "spu_us_dummy", "spu_ds_dummy", "sit0", "imq0", "imq1", "imq2", "ifb0", "ifb1", "ip6tnl0", "ip6gre0" and "dpsta".

    The default macro uses this regular expression:
    (^Software Loopback Interface|^NULL[0-9.]*$|^[Ll]o[0-9.]*$|^[Ss]ystem$|^Nu[0-9.]*$|^veth[0-9a-z]+$|docker[0-9]+|br-[a-z0-9]{12})
    To ignore those interfaces I thought of adding some terms:
    (^Software Loopback Interface|^NULL[0-9.]*$|^[Ll]o[0-9.]*$|^[Ss]ystem$|^Nu[0-9.]*$|^veth[0-9a-z]+$|docker[0-9]+|br-[a-z0-9]{12}|dpsta|spu_[du]s_dummy|sit0|ifb[0-9]|imq[0-9]|ip6[gre|tnl]0)
    With that, most interfaces are ignored but "ip6tnl0" and "ip6gre0" are still discovered.

    Could anyone help me enhance that macro?
    Thanks
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    The last one should be:

    Code:
    ip6(gre|tnl)0

    Comment


    • markfree
      markfree commented
      Editing a comment
      It now works as expected. Thanks.
Working...