Ad Widget

Collapse

Interface Discovery regex filter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • axlrod
    Junior Member
    • Dec 2015
    • 7

    #1

    Interface Discovery regex filter

    I'm getting really frustrated now, I created a regex to match cisco or HP equipment interface names that I care about:

    ^.*Ethernet[\d][\/][\d].*$|^\w\d{1,2}$

    Feel free to play around here:
    Online regex tester and debugger with real-time match highlighting, detailed explanations, substitutions, unit tests, benchmarking, and code generation. Supports PCRE2, JavaScript, Python, Go, Java, .NET, Rust, POSIX ERE, and POSIX BRE.


    It basically matches any interface that has
    Cisco: xEthernetx/xxx
    OR
    HP: A1 - XX or 1-XX

    This works fine on my regex tester.. but when I add it to zabbix in the global regex, it complaints:

    Incorrect regular expression "^.*Ethernet[\d][\\/][\d].*$|^\w\d{1,2}$": "Unknown modifier ']'"

    Oookay.. it did an escape on my escape delimiter ??

    So I remove the escape I have on /
    ^.*Ethernet[\d][/][\d].*$|^\w\d{1,2}$

    And it tests ok on all my tests in Zabbix regex tester..
    But I get nothing discovered..

    My discovery filter:



    My global Regex:


    What am I doing wrong??
  • herta
    Senior Member
    • Sep 2011
    • 101

    #2
    Try putting it in braces:

    ^(.*Ethernet[\d][\/][\d].*$|^\w\d{1,2})$

    Comment

    • axlrod
      Junior Member
      • Dec 2015
      • 7

      #3
      I've added 2 rules where I expect them to return false instead.. this simple regex seems to work..

      ^.*Ethernet0$
      Null|StackPort|loopback|management|vlan

      Your rule again seems to work like mine did, but I haven't tested it.

      Comment

      Working...