Ad Widget

Collapse

Zabbix regex slash makes invalid regular expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stanley783
    Junior Member
    • Nov 2020
    • 6

    #1

    Zabbix regex slash makes invalid regular expression

    Configuring item and trigger for trap message about linkdown. I am not using predefined templates as i want, on most of the switches, to monitor only 2 specific ports per host.

    Trap as follows:

    Code:
    15:42:44 2021/01/10 PDU INFO:
    errorstatus 0
    securitymodel 3
    contextEngineID 0x800000090
    securityName zab-monx
    securityEngineID 0x800000090
    errorindex 0
    notificationtype TRAP
    contextName
    receivedfrom UDP: [10.110.30.8]:49238->[10.110.255.22]:162
    requestid 2518109
    messageid 834855
    version 3
    transactionid 378309
    securitylevel 2
    VARBINDS:
    DISMAN-EXPRESSION-MIB::sysUpTimeInstance type=67 value=Timeticks: (1137254182) 131 days, 15:02:21.82
    SNMPv2-MIB::snmpTrapOID.0 type=6 value=OID: IF-MIB::linkDown
    IF-MIB::ifIndex.10619 type=2 value=INTEGER: 10619
    IF-MIB::ifDescr.10619 type=4 value=STRING: "GigabitEthernet2/0/19"
    IF-MIB::ifType.10619 type=2 value=INTEGER: 6
    SNMPv2-SMI::enterprises.9.2.2.1.1.20.10619 type=4 value=STRING: "down"
    which is matched by:
    Code:
    snmptrap["(IF-MIB::linkDown|IF-MIB::linkUp)((.|[[:space:]])*)(19)"]
    but not by:

    Code:
    snmptrap["(IF-MIB::linkDown|IF-MIB::linkUp)((.|[[:space:]])*)(2/0/19)"]
    Any idea how to fix this? I would say different line is not a problem as "19" is matched (also "10619" is), or do i miss any character? It seems it has issue with string or "".


    Thanks.
    Last edited by stanley783; 10-01-2021, 17:14.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    https://regex101.com/ helps..
    / An unescaped delimiter must be escaped with a backslash (\)
    /-s should be escaped, \/

    Comment

    Working...