Ad Widget

Collapse

change trigger behavior to trigger only if Interface alias not contain # character

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ivo.micanek
    Junior Member
    • Nov 2023
    • 3

    #1

    change trigger behavior to trigger only if Interface alias not contain # character

    Hello,
    Im new in Zabbix and now dealing with this specific problem. We have lots of switches with houndreds of interfaces and not all of them are interesting for us. we want to gather data from them but dont know to notify about them. Fot this we marked those interfaces with mark # to their alias. Problem expression for "Link down" looks like this:
    ​​​​​​{$IFCONTROL:"{#IFNAME}"}=1 and last(/Cisco IOS by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2 and (last(/Cisco IOS by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#1)<>last(/Cisco IOS by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#2)) and "{#IFALIAS}"<>"#"

    i only add last ​condition which works only when alias is "#" and nothing else.
    My question is - how can i add any regular expression here as for example "^#*" not working at all.
    I need to construct expression to check only if first character is # and could have any other characters folowing. for example #test or #deploy

    thanks in advance
    Ivo
  • Answer selected by ivo.micanek at 10-11-2023, 11:36.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    find (/host/key,<(sec|#num)<:time shift>>,<operator>,<pattern>)
    Find a value match.
    Operator can be "regex".

    But you can also look up "overrides" in discovery and let those triggers be created already in disabled state or not create at all.. ​

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #2
      find (/host/key,<(sec|#num)<:time shift>>,<operator>,<pattern>)
      Find a value match.
      Operator can be "regex".

      But you can also look up "overrides" in discovery and let those triggers be created already in disabled state or not create at all.. ​

      Comment

      • ivo.micanek
        Junior Member
        • Nov 2023
        • 3

        #3
        Hello,

        Thank You!
        Override did the job
        Click image for larger version

Name:	image.png
Views:	652
Size:	9.6 KB
ID:	473803

        Comment

        • ivo.micanek
          Junior Member
          • Nov 2023
          • 3

          #4
          Hello,

          if somebody interesting i made change to trigger expression to make it even better than with override. Disadvantage of override in this case is that its working only in discovery of port - any change of port ALIAS during monitoring not affect override = if i change port ALIAS to # after discovery nothing changed.
          To working it i have to go back to my previous idea and update trigger expression. Just add this line

          {{#IFALIAS}.regsub("^(?!.*#).*$", 1)}=1
          Click image for larger version

Name:	image.png
Views:	644
Size:	5.6 KB
ID:	475806
          This will help me trigger notification only if port is down and not have # in port ALIAS, which we are using to specify not ciritical port.
          Last edited by ivo.micanek; 14-12-2023, 11:00.

          Comment

          • juanmarcos
            Junior Member
            • Feb 2025
            • 4

            #5
            Originally posted by ivo.micanek
            update trigger expression
            If you ask me, that macro is also only expanded when trigger is created, i.e. only each time discovery is run.
            If you look at a trigger instantiation you'll probably see sth like "1=1" (which is only going to be updated upon discovery)

            Comment

            Working...