Ad Widget

Collapse

SNMP LLD manipulate item key and / or name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rataplan626
    Junior Member
    • Jun 2013
    • 9

    #1

    SNMP LLD manipulate item key and / or name

    I've been reading the 4.0 manual for about 10 times now and I've been searching the forum for an hour. Can't find my answer. We have setup an SNMP LLD to discover switchports on a stack of two switches. These are 2 24 port switches, stacked as one logical unit. Functionally it works fine, but visually I want to improve some things. The 24 ports of the first physical switch get interface index 1-24. Switch 2 gets 1-24 + 256. So when port 5 of switch 2 would go down, ifOperStatus.261 would be down.

    My discovery rule for the ports is setup as discovery[{#SNMPVALUE},.1.3.6.1.2.1.2.2.1.7]

    For the items:
    Name: ifOperStatus.$1
    Key: ifOperStatus.[{#SNMPINDEX}]
    SNMP OID: .1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}

    I'd like to replace at least the name (ie. the $1) with 'eth 1/<1-24>' if $1 is between 1 and 24, and with 'eth 2/<1-24>' so it's more obvious which port would we are actually looking at. Preferably I'd replace the key as well the same way. I tried with examples at https://www.zabbix.com/documentation...acro_functions, and I replaced my key with things like ifOperStatus.[{{#SNMPINDEX},regsub(1,eth 1/\0)}] so for the port 1 that should be replaced. I can't get it to work though, it keeps telling me there are errors in my key format.

    How can I achieve this, I'm clearly at the wrong path.
    Last edited by Rataplan626; 08-04-2019, 12:48.
Working...