Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-9518

Support uneven OID depths in "SNMP walk to JSON"

XMLWordPrintable

      While trying to process sensor MIBs (eg ZBXNEXT-9517) I often run into situation where I need data from two tables.

      $ snmpwalk -On -c foobar -v2c r1.brueve 1.3.6.1.2.1.31.1.1.1.1.4671
      .1.3.6.1.2.1.31.1.1.1.1.4671 = STRING: "et-8/0/5"
      $ snmpwalk -On -c foobar -v2c r1.brueve 1.3.6.1.4.1.2636.3.60.1.2.1.1.6.4671
      .1.3.6.1.4.1.2636.3.60.1.2.1.1.6.4671.0 = INTEGER: -230
      .1.3.6.1.4.1.2636.3.60.1.2.1.1.6.4671.1 = INTEGER: -146
      .1.3.6.1.4.1.2636.3.60.1.2.1.1.6.4671.2 = INTEGER: -209
      .1.3.6.1.4.1.2636.3.60.1.2.1.1.6.4671.3 = INTEGER: -265

      Notice how table with interface names has one level (4671), but its sensors have two levels (4671.x).

       
      Currently "SNMP walk to JSON" does not handle this in useful way:

      Field name OID prefix Format
      {#IFNAME}|1.3.6.1.2.1.31.1.1.1.1|Unchanged|
      |{#SENSOR_VALUE}|1.3.6.1.4.1.2636.3.60.1.2.1.1.6|Unchanged|
      
      

      [
      {
      "{#SNMPINDEX}": "4671.2",
      "{#SENSOR_VALUE}": "-209"
      },
      {
      "{#SNMPINDEX}": "4671.1",
      "{#SENSOR_VALUE}": "-146"
      },
      {
      "{#SNMPINDEX}": "4671.0",
      "{#SENSOR_VALUE}": "-230"
      },
      {
      "{#SNMPINDEX}": "4671",
      "{#IFNAME}

      ": "et-8/0/5"
      },

      Unknown macro: { "{#SNMPINDEX}": "4671.3",
      "{#SENSOR_VALUE}": "-265"
      }
      ]
      
      


      It would be more useful if shorted SNMPINDEX values get expanded and give this:
      
      

      [
      {
      "{#SNMPINDEX}"}

      ,

      Unknown macro: { "{#SNMPINDEX}"}

      ]

      
      

            vmurzins Valdis Murzins
            user185953 user185953
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: