Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-22396

SNMP Walk to JSON preprocessing does not work with different size OIDs before index

XMLWordPrintable

    • Sprint 97 (Feb 2023)
    • 0.5

      Steps to reproduce:
      1. Create preprocessing step SNMP Walk to JSON
      2. Load test data:
      Test value

      .1.3.6.1.2.1.31.1.1.1.1.11001 = STRING: Fa3/0/1
      .1.3.6.1.2.1.31.1.1.1.1.11002 = STRING: Fa3/0/2
      .1.3.6.1.2.1.31.1.1.1.1.11003 = STRING: Fa3/0/3
      .1.3.6.1.2.1.31.1.1.1.1.11004 = STRING: Fa3/0/4
      .1.3.6.1.2.1.31.1.1.1.18.11001 = STRING: Router
      .1.3.6.1.2.1.31.1.1.1.18.11002 = STRING: Printer
      .1.3.6.1.2.1.31.1.1.1.18.11003 = STRING: Smart TV
      .1.3.6.1.2.1.31.1.1.1.18.11004 = STRING: Unused

      Field name: {#IFNAME} OID prefix .1.3.6.1.2.1.31.1.1.1.1
      Field name: {#IFALIAS}  OID prefix .1.3.6.1.2.1.31.1.1.1.18
      3. Press Test and look at the result - the JSON structure is wrong

      [
          {
              "{#SNMPINDEX}": ".11003",
              "{#IFNAME}": "Smart TV"
          },
          {
              "{#SNMPINDEX}": ".11002",
              "{#IFNAME}": "Printer"
          },
          {
              "{#SNMPINDEX}": ".11004",
              "{#IFNAME}": "Unused"
          },
          {
              "{#SNMPINDEX}": "11004",
              "{#IFNAME}": "Fa3/0/4",
              "{#IFALIAS}": "Unused"
          },
          {
              "{#SNMPINDEX}": "11002",
              "{#IFNAME}": "Fa3/0/2",
              "{#IFALIAS}": "Printer"
          },
          {
              "{#SNMPINDEX}": "11001",
              "{#IFNAME}": "Fa3/0/1",
              "{#IFALIAS}": "Router"
          },
          {
              "{#SNMPINDEX}": "11003",
              "{#IFNAME}": "Fa3/0/3",
              "{#IFALIAS}": "Smart TV"
          },
          {
              "{#SNMPINDEX}": ".11001",
              "{#IFNAME}": "Router"
          }
      ] 

      4. This happens because .1.3.6.1.2.1.31.1.1.1.1.11001 and .1.3.6.1.2.1.31.1.1.1.18.1100 has different length

      Expected:
      A proper JSON is returned

      [
          {
              "{#SNMPINDEX}": "11004",
              "{#IFNAME}": "Fa3/0/4",
              "{#IFALIAS}": "Unused"
          },
          {
              "{#SNMPINDEX}": "11002",
              "{#IFNAME}": "Fa3/0/2",
              "{#IFALIAS}": "Printer"
          },
          {
              "{#SNMPINDEX}": "11001",
              "{#IFNAME}": "Fa3/0/1",
              "{#IFALIAS}": "Router"
          },
          {
              "{#SNMPINDEX}": "11003",
              "{#IFNAME}": "Fa3/0/3",
              "{#IFALIAS}": "Smart TV"
          }
      ] 

            dgoloscapov Dmitrijs Goloscapovs
            kaspars.mednis Kaspars Mednis
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: