[ZBX-22396] SNMP Walk to JSON preprocessing does not work with different size OIDs before index Created: 2023 Feb 22  Updated: 2024 Apr 10  Resolved: 2023 Feb 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 6.4.0rc1
Fix Version/s: 6.4.0rc3, 6.4 (plan)

Type: Problem report Priority: Critical
Reporter: Kaspars Mednis Assignee: Dmitrijs Goloscapovs (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team A
Sprint: Sprint 97 (Feb 2023)
Story Points: 0.5

 Description   

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"
    }
] 


 Comments   
Comment by Kaspars Mednis [ 2023 Feb 22 ]

Adding a trailing dot at the end of OID will fix the problem

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.

This must be fixed or properly documented. If dot is required, frontend must give a validation error.

Previous implementation of SNMP discovery worked without trailing dots, a lot of long-time Zabbix users are used to this oid format

discovery{#IFOPERSTATUS},1.3.6.1.2.1.2.2.1.8,{#IFADMINSTATUS},1.3.6.1.2.1.2.2.1.7,{#IFALIAS},1.3.6.1.2.1.31.1.1.1.18,{#IFNAME},1.3.6.1.2.1.31.1.1.1.1,{#IFDESCR},1.3.6.1.2.1.2.2.1.2,{#IFTYPE},1.3.6.1.2.1.2.2.1.3
Comment by Dmitrijs Goloscapovs (Inactive) [ 2023 Feb 27 ]

Available in versions:

Generated at Sat Jun 13 03:47:15 EEST 2026 using Jira 10.3.18#10030018-sha1:5642e4ad348b6c2a83ebdba689d04763a2393cab.