[ZBX-4709] SNMP text values contain surrounding quotes when processed with *.regexp() Created: 2012 Feb 29  Updated: 2017 May 30  Resolved: 2012 Jun 13

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.0rc1
Fix Version/s: 1.8.12rc2, 2.0.0rc3

Type: Incident report Priority: Minor
Reporter: Jens Berthold Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: regexps, snmp, trigger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian 6.0.3
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64)
PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli)


Attachments: Text File zabbix_server-dynamic_index.log    
Issue Links:
Duplicate
duplicates ZBX-4793 SNMP item with dynamic indexes fail: ... Closed

 Description   

I use a global regular expression in a trigger for an SNMP item (example value: "54 C"):

{MyHost:SystemTemperature.regexp(@QNAP-SysTemp-OK)}

=0

The regexp only works if I include the surrounding quotes:
This works: ^"[1-5][0-9] C"$
This doesn't: ^[1-5][0-9] C$

I guess the intended behaviour should be to strip off the quotes from the SNMP text values before they are further processed by Zabbix.



 Comments   
Comment by Jens Berthold [ 2012 Feb 29 ]

I just saw that it is generally true that all SNMP text values are shown with quotes everywhere in Zabbix. So maybe the issue title should be changed...

Comment by Jens Berthold [ 2012 Mar 09 ]

I found out that Zabbix shows the quotes for snmp text values only if SNMP OID is unknown to Zabbix.

So this item is shown with quotes: .1.3.6.1.2.1.47.1.1.1.1.13.1001
...while this one is shown correctly: ENTITY-MIB::entPhysicalModelName.1001
(If the SNMP MIB is on the system, of course)

Comment by dimir [ 2012 Apr 04 ]

What type of the device is it that you are monitoring?

Comment by dimir [ 2012 Apr 04 ]

If you request the item value using snmpwalk do you get quoted return value?

Comment by Jens Berthold [ 2012 Apr 04 ]

The first example was from a QNAP Storage, the one in my second comment from a Cisco switch.

Oh... I see, it's also quoted when using the OID with snmpget on the command line:
root@myhost:~# snmpget -v 2c -c mycomm 1.2.3.4 ENTITY-MIB::entPhysicalFirmwareRev.1001
ENTITY-MIB::entPhysicalFirmwareRev.1001 = STRING: 12.2(35)SE5
root@myhost:~# snmpget -v 2c -c mycomm 1.2.3.4 1.3.6.1.2.1.47.1.1.1.1.9.1001
SNMPv2-SMI::mib-2.47.1.1.1.1.9.1001 = STRING: "12.2(35)SE5"

Comment by dimir [ 2012 Apr 05 ]

So, I guess the problem is not on Zabbix side?

Comment by Jens Berthold [ 2012 Apr 05 ]

You are right, it's not on Zabbix' side - no work for you this time
But it might be a good idea to include some short hint in the documentation about that fact.

Comment by Cristian Mammoli [ 2012 Apr 05 ]

Yeah, strings are always quoted in snmpwalk if you don't have the correct MIB. Sometimes anyway, maybe because of crappy 3rd party mibs, they are quoted even if the MIB is present:

[root@srvzabbix ~]# snmpwalk -c public -v 2c quescom -m +QUESCOM-MIB QUESCOM-MIB::voipType.0.0
QUESCOM-MIB::voipType.0.0 = STRING: "Foreign SIP Device"

I know it's not Zabbix fault, but having an option to strip quotes would be nice!

Comment by dimir [ 2012 Apr 10 ]

OK, that makes sense. We decided to get back to this issue after 2.0 is out.

Comment by Kodai Terashima [ 2012 Apr 13 ]

This problem is happened on snmp dynamic index as well. I also think it's better that Zabbix server remove quotes.

  1. snmpwalk -v2c -c public -On localhost 1.3.6.1.2.1.25.4.2.1.2
    .1.3.6.1.2.1.25.4.2.1.2.1 = STRING: "init"
    .1.3.6.1.2.1.25.4.2.1.2.2 = STRING: "migration/0"
    .1.3.6.1.2.1.25.4.2.1.2.3 = STRING: "ksoftirqd/0"
    .1.3.6.1.2.1.25.4.2.1.2.4 = STRING: "events/0"
    ...

In this case, simple snmp item with .1.3.6.1.2.1.25.4.2.1.2.1 in OID store value "init" (with quotes) to DB. Dynamic index 1.3.6.1.2.1.25.4.2.1.6["index","1.3.6.1.2.1.25.4.2.1.2","init"] doesn't work. Because Zabbix server try to compare init and "init". I attached debug log.

I confirm dynamic index 1.3.6.1.2.1.25.4.2.1.6["index","1.3.6.1.2.1.25.4.2.1.2","\"init\""] works on 1.8.11.

Comment by Alexander Vladishev [ 2012 Apr 16 ]

Will be fixed with ZBX-4793.

Comment by dimir [ 2012 Apr 17 ]

This appeared to be a regression so will be fixed in both 1.8 and 2.0 .

Comment by Alexander Vladishev [ 2012 Apr 17 ]

Fixed in version pre-1.8.12 r26905 and pre-2.0.0rc3 r26919.

Generated at Sat Apr 20 09:54:50 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.