Ad Widget

Collapse

Can you help me out with a simple regular expression / macro?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bog
    Junior Member
    • Oct 2020
    • 7

    #1

    Can you help me out with a simple regular expression / macro?

    Good evening,

    I'm monitoring some switches with Zabbix. Discovery found out (with cisco net template snmpv2) 9k items from which I only use 4k. The rest I have manually disabled them.
    Even disabled, they do not disappear, from graphs, triggers, items, because they are still discovered. Obviously

    I spent a lot of time trying to filter them out by name but I cannot get it done. The interfaces which I do not want are "Interface VLAN", "stackport" and "stacksub" (once again, filter by name was my intention)
    In regular expressions, return in false ^(Interface VLAN|StackSub|StackPort)*$
    This is what I tried but not working. I tried the same expression in macros in Cisco template.

    Thank you for your time.
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    What is the "*" for? Are those the full string or do they have something followking, like "Interface VLAN 1"? If so, then you may want ^(Interface VLAN|StackSub|StackPort).*$. But that made me wonder about the $ at the end.

    I test on regex101.com :-)

    Comment

    • bog
      Junior Member
      • Oct 2020
      • 7

      #3
      I made some progress. It looks like i got rid of stacksub and stackport, but not interface vlan. it should had work tho, isn't the same principle?
      the name of the interfaces is Interface Vlan-1() ; Interface Vlan-2() and all the way to Interface Vlan-2000(). I tried various combinations (vlan, vlan-, interface vlan...) but it doesn't want to go away.

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        Regex expressions are case-sensitive.
        Code:
        ^(Interface Vlan|StackSub|StackPort).*$

        Comment

        • bog
          Junior Member
          • Oct 2020
          • 7

          #5
          Thank you but still no result. The vlan interfaces get discovered

          Comment

          • Hamardaban
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2019
            • 2713

            #6
            Check you strings at regex101.com

            Comment

            • bog
              Junior Member
              • Oct 2020
              • 7

              #7
              it finally worked
              template, filters, (^VLAN).*$
              4500 items are no longer discovered and will be deleted

              You both are good, thanks a lot.

              Comment

              • LenR
                Senior Member
                • Sep 2009
                • 1005

                #8
                The filter sees what is returned in discovery, in your case "VLAN", I think you shared the item descriptions "Interface VLAN" which is from the prototype format

                Comment

                Working...