Zabbix-Addons icon indicating copy to clipboard operation
Zabbix-Addons copied to clipboard

Empty {#ADVSNMPINDEX1}

Open ojab opened this issue 13 years ago • 2 comments

I'm trying to get list of Cisco's E1 interfaces, it's formatted as .1.3.6.1.4.1.9.10.19.1.1.9.1.3.slot.port, so 4-port card in slot 6 looks like:

$ snmpwalk -c Asoramog -v2c 10.32.3.40 .1.3.6.1.4.1.9.10.19.1.1.9.1.3 SNMPv2-SMI::enterprises.9.10.19.1.1.9.1.3.6.0 = Gauge32: 19 SNMPv2-SMI::enterprises.9.10.19.1.1.9.1.3.6.1 = Gauge32: 20 SNMPv2-SMI::enterprises.9.10.19.1.1.9.1.3.6.2 = Gauge32: 12 SNMPv2-SMI::enterprises.9.10.19.1.1.9.1.3.6.3 = Gauge32: 27

but advsnmp.discovery output looks like

$ /usr/local/share/zabbix/externalscripts/advsnmp.discovery "10.32.3.40" "-v2c -cAsoramog" ".1.3.6.1.4.1.9.10.19.1.1.9.1.3" "1.2" { "data":[ { "{#ADVSNMPINDEX1}": "", "{#ADVSNMPINDEX2}": "6.0", "{#ADVSNMPVALUE}":"20" } , { "{#ADVSNMPINDEX1}": "", "{#ADVSNMPINDEX2}": "6.1", "{#ADVSNMPVALUE}":"21" } , { "{#ADVSNMPINDEX1}": "", "{#ADVSNMPINDEX2}": "6.2", "{#ADVSNMPVALUE}":"21" } , …

because $line_index in foreach my $line_index (sort keys %INDEXES) block looks like ";6.0", ";6.1", ";6.2", ";6.3" (tested on CentOS 5.8 [net-snmp-5.3.2.2-17.el5_8.1] and FreeBSD 8.2 [net-snmp-5.7.1]) and ( split(/;/, $line_index) creates two indexes, first is empty.

ojab avatar Aug 28 '12 09:08 ojab

Looks like sanitizing in another place helps, see https://github.com/ojab/Zabbix-Addons/commit/d9c62bd12128f8c7772e3cc2fb80657508dd3221

ojab avatar Aug 28 '12 09:08 ojab

The ojab proposal works greats for me. Thanks

juampe avatar Aug 26 '13 10:08 juampe