[ZBX-23607] "SNMP walk to JSON" preprocessing step cannot parse unquoted values that start with a double quote character Created: 2023 Oct 25 Updated: 2024 Apr 10 Resolved: 2024 Feb 23 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Proxy (P), Server (S) |
Affects Version/s: | 6.4.8rc1 |
Fix Version/s: | 6.4.12rc1, 7.0.0beta2, 7.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Andrejs Sitals (Inactive) | Assignee: | Andrejs Sitals (Inactive) |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Team: | |
Sprint: | Sprint candidates, S2401-1, S2401-2 |
Story Points: | 1 |
Description |
It looks like algorithms used by snmpwalk to decide if the string should be quoted depend on presence of MIB and presence of hint for an OID in the MIB, at least that's my understanding after taking a quick look at SNMP code. As a result, it is possible to get unquoted string that starts with a double quote character. When parsing such string, Zabbix assumes that it is a quoted string and expects it to end with an unescaped double quote character. As a result, parsing fails and returns "no data was found" or "invalid text following value" error. Some synthetic data examples include: .1.3.6.1.2.1.1.1.0 = STRING: " .1.3.6.1.2.1.1.1.0 = STRING: "foo bar" baz .1.3.6.1.2.1.1.1.0 = STRING: "foo bar" baz foo bar .1.3.6.1.2.1.1.1.0 = STRING: "foo bar" baz When testing with snmpsimd and snmpwalk, it is possible to get all these outputs. This was discovered while reviewing real snmpwalk output after fixing .1.3.6.1.2.1.31.1.1.1.18.1234561 = STRING: "xxx::xxx-xxx-xxx xx01" .1.3.6.1.2.1.31.1.1.1.18.1234562 = STRING: "xxx::xxx-xxx-xxx xx02" .1.3.6.1.2.1.31.1.1.1.18.1234563 = STRING: "xxx::xxx-xxx-xxx xx03" (shut:<something>) |
Comments |
Comment by Andrejs Sitals (Inactive) [ 2024 Feb 16 ] |
Available in versions:
|
Comment by Andrejs Sitals (Inactive) [ 2024 Feb 16 ] |
Modifying parser to make it able to parse unquoted values that start with a double quote character leads to having different corner cases that would not be handled properly. Therefore, instead of modifying the parser, it was decided to modify output of SNMP agent's walk[] item. Previously some string values were quoted, some were not quoted, based on the presence of display hint for the OID. Sometimes the value looked like it is quoted, but the quote characters were in fact parts of the actual value (and were incorrectly removed by the parser). Now all string values should be quoted, even when display hint is present for the OID, and parser should be able to parse them correctly. If the item with an "SNMP walk to JSON" preprocessing step receives a value from an external source (e.g., from an snmpwalk command that was pushed to a Trapper item or executed via Zabbix agent's UserParameter), it will still contain a hard-to-parse values and parsing it may fail. Unfortunatelly, we can't do much about it. The fix works only with SNMP data that was produced by Zabbix SNMP agent. |