Ad Widget

Collapse

Create trigger only if interface alias does contain _ Character

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nichoals.daniels
    Junior Member
    • May 2024
    • 2

    #1

    Create trigger only if interface alias does contain _ Character

    Hello,

    newer to zabbix and trying my hand at a custom trigger while using the hp Enterprise Switch by SNMP Discovery Template.

    in our switches we really only care when some of our ports go down because people constantly having meeting and unplugging laptops, moving them, etc. so in the items we care about they all have a _ (underscore) in them (i.e. interface 1/5(A5_AP_Auditorium): Link down) the A5_AP_Auditorium comes from the macro {#IFALIAS} and basically what i am trying to get is only items that have _ should have triggers created for them.

    I tried following this post here, change trigger behavior to trigger only if Interface alias not contain # character - ZABBIX Forums but that didnt seemed to work for m. instead in the trigger it would just show 1=0 (after i altered it slightly to work with a "_" and used 0 because i wanted only used item that had a underscore).

    after further digging i tried to use this command {{#IFALIAS}.regexp(".*_.*")}=1 which should work to detect if there is a underscore in IFALIAS below is the altered trigger i made from the default HP Template that i stated above that sees if a port is down.
    {{#IFALIAS}.regexp(".*_.*")}=1 and {$IFCONTROL:"{#IFNAME}"}=1 and last(/HP Enterprise Switch by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2 and (last(/HP Enterprise Switch by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#1)<>last(/HP Enterprise Switch by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#2))

    but i cant seem to get it to work right as items with out a underscore are still showing up, the only difference i see is that in the host under triggers it has that part in quotes and cant seem to figure out why
    ​​Click image for larger version

Name:	image.png
Views:	160
Size:	17.0 KB
ID:	487683

    any help would be really apreciated!
Working...