[ZBXNEXT-3344] SNMP OID longer than 255 Created: 2015 Feb 13  Updated: 2017 Aug 22  Resolved: 2016 Nov 25

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: API (A), Installation (I)
Affects Version/s: None
Fix Version/s: 3.4.0alpha1, 3.4 (plan)

Type: Change Request Priority: Critical
Reporter: Dan Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: fieldlength, snmp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Centos 6.6 x64


Attachments: PNG File SNMP Index.png     Text File zabbix-oid-len.patch    
Issue Links:
Duplicate
is duplicated by ZBX-9521 Cannot add SNMP item with OID > 255 c... Closed
is duplicated by ZBX-9671 OID field to short Closed

 Description   

I was trying to collect firewall policy from Juniper devices.
The name of policy are in ASCI format and a longer than 255 characters.
SNMP indexes that are shorter are working fine.

Example of long SNMP Index:
.1.3.6.1.4.1.2636.3.5.2.1.8.31.49.49.48.55.95.102.105.108.116.101.114.45.111.117.116.45.120.101.45.48.47.48.47.49.46.49.49.48.55.45.111.34.69.117.114.111.108.117.109.105.110.97.45.101.120.116.45.111.117.116.45.120.101.45.48.47.48.47.49.46.49.49.48.55.45.111.2

Also I've added a screenshot that shows that it stops at.45.11.

Any suggestions are appreciated.
Thank you.
Kind regards,
Dan



 Comments   
Comment by richlv [ 2015 Feb 13 ]

confirming, db schema does limit snmp oid to 255 chars

Comment by Dan [ 2015 Feb 13 ]

Are there any workarounds for this issue?

Comment by Alexander Vladishev [ 2015 Feb 16 ]

As workaround you can use user macros to define a part of the SNMP OID.

For example:

User macro:
    {$OID_PREFIX}     .1.3.6.1.4.1.2636.3.5.2.1.8.31.49.49.48.55.95.102.105.108.116.101.114.45.111.117.116.45.120
SNMP OID:
    {$OID_PREFIX}.101.45.48.47.48.47.49.46.49.49.48.55.45.111.34.69.117.114.111.108.117.109.105.110.97.45.101.120.116.45.111.117.116.45.120.101.45.48.47.48.47.49.46.49.49.48.55.45.111.2
Comment by Dan [ 2015 Feb 16 ]

Hi,
Alexander Vladishev Thank you very much for your reply, it's a great idea but in my case only ".1.3.6.1.4.1.2636.3.5.2.1." is the same and I'm using discovery template for gathering Items.

Comment by Dan [ 2015 Feb 26 ]

Hi all,
Guys do you have any other ideas,suggestions ?
This is critical for me.

Thank you very much!

Comment by Dan [ 2015 Mar 16 ]

Hi all,

Are there any updates on this case ?
Will be included in next release ?

Thank you.
Dan

Comment by richlv [ 2015 Mar 16 ]

it's not on the roadmap currently

Comment by Dan [ 2015 Mar 16 ]

Thank you for prompt reply.

Comment by Dan [ 2015 Aug 20 ]

Hi all,
I was wandering if this case was added on roadmap.
Thank you for update.

Comment by richlv [ 2015 Aug 20 ]

irc would be a better place for discussions and questions - please see https://www.zabbix.org/wiki/Getting_help for more detail

Comment by Patrick Hemmer [ 2016 Apr 11 ]

I created a patch which resolves this issue (attached). It increases the max OID len to 511.

Comment by Viktors Tjarve [ 2016 Jul 27 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-3344

Upgrade form 3.0.5rc1 successfully tested.

Comment by Sandis Neilands (Inactive) [ 2016 Jul 28 ]

Successfully tested.

  • This change must be described in upgrade notes as upgrade on systems with many items might take a while.
  • ITEM_SNMP_OID_LEN is used in stack-allocated arrays of items, etc. Memory usage and cache misses might increase since it was increased from 255 to 512.
Comment by vitalijs.cemeris (Inactive) [ 2016 Aug 01 ]

(1) [A] [F] Translation string changes
Strings deleted:

  • SNMP Key
  • Incorrect key

Strings added:

  • %1$d characters exceeds maximum length of %2$d characters

oleg.egorov CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Aug 02 ]

(2) [F] Changed SNMP OID maxlength value in discovery rules checks.
RESOLVED r61259, r61260, r61300, r61313, r61315

viktors.tjarve CLOSED

Comment by Viktors Tjarve [ 2016 Aug 02 ]

(3) [S] [I] Increased SNMP OID size from 255 to 512 bytes in DB and frontend for filters and discovery rule check.

viktors.tjarve RESOLVED in r61337.

sasha CLOSED

Comment by Sandis Neilands (Inactive) [ 2016 Aug 03 ]

(4) [S] Changes in dchecks must be upgraded as well.

viktors.tjarve RESOLVED in r61432.

sasha CLOSED

Comment by Sandis Neilands (Inactive) [ 2016 Aug 03 ]

(5) [A] Presumably API will allow saving discovery item keys longer than 255 bytes since the size of the key_ field in dchecks table is now increased? Should we split the field also in DB?

viktors.tjarve After short discussion it was decided not to create new fields in DB only make changes in API to validate key length.

vitalijs.cemeris RESOLVED in r62043

oleg.egorov CLOSED

Comment by Viktors Tjarve [ 2016 Aug 18 ]

(6) [I] DB field key_ from dservices too small (255 bytes) to hold values from discovered rule checks field key_ from dchecks (512 bytes).

viktors.tjarve RESOLVED in r61684, r61734.
Upgrade successfully tested.

sasha CLOSED

Comment by Sandis Neilands (Inactive) [ 2016 Aug 19 ]

(7) [D] Documentation - what's new.

viktors.tjarve Also make changes in:

viktors.tjarve RESOLVED

martins-v Looks good to me. CLOSED

Comment by Sandis Neilands (Inactive) [ 2016 Aug 19 ]

(8) [S] [P] [I] Key length of proxy_dhistory table must be increased as well.

viktors.tjarve RESOLVED in r62295.

sasha CLOSED

Comment by Sandis Neilands (Inactive) [ 2016 Aug 22 ]

(9) [I] wiper suggests also checking these changes on DB2 as a sanity check due to a more limited maximum row length.

sasha Successfully tested! CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Aug 26 ]

(10) It is possible to save LLD and Network discovery with SNMP OID that is not in ASCII.

viktors.tjarve It is possible to save non-ASCII characters but all the LLD entries are validated in backend (function lld_validate_item_field()). If there is an invalid character "Status" will be "Not supported" with a description under "Info".
RESOLVED.

oleg.egorov CLOSED

Comment by Alexander Vladishev [ 2016 Sep 07 ]

(11) incorrect database version in schema.tmpl

sasha RESOLVED in r62351.

viktors.tjarve CLOSED.

Comment by Viktors Tjarve [ 2016 Sep 07 ]

(12) DSERVICE_KEY_LEN and PROXY_DHISTORY_KEY_LEN (include/db.h) has to be increased from 255 to 512 bytes after related field size in DB are increases in size.

viktors.tjarve RESOLVED in r62357.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Sep 08 ]

(13) Cannot created database on MySQL

ERROR 1071 (42000) at line 1217: Specified key was too long; max key length is 767 bytes

viktors.tjarve RESOLVED in r62601 and r62627.
Added upgrade patches successfully tested performing upgrade with MySQL and Oracle DB.

viktors.tjarve This will cause upgrade to fail when creating unique index for entries that have lost uniqueness due to removing fields type and key_ in table dservices. Dublicate entries have to be removed before creating unique index.

viktors.tjarve RESOLVED. Changes made in-between r62948 and r62995.
Added upgrade patches successfully tested performing upgrade with MySQL DB.

sasha CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Sep 23 ]

(14) [F] Screen "Discovery" is affected.

RESOLVED in r62739

iivs The order of records in Monitoring -> Discovery is now changed (1, 10, 11 ...). It used to be fine. Now it does not follow natural sort order.

REOPENED

gunarspujats RESOLVED in r62999

iivs Fixed inproper coding style in r63011. Please, review.
RESOLVED

gunarspujats CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(15) [AF] schema.inc.php was not updated

sasha RESOLVED in r62996

iivs CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(16) [S] DSERVICE_KEY_LEN is not used and can be removed from code

viktors.tjarve RESOLVED in r62997.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(17) [S] src/zabbix_server/actions.c:719: extra-space between table names

result = DBselect(
                "select dc.type"
                " from dservices ds, dchecks dc"
                " where ds.dserviceid=" ZBX_FS_UI64,
                event->objectid);

viktors.tjarve RESOLVED in r62998.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(18) [S] src/zabbix_server/actions.c:717: this SQL statement is incorrect. Condition for tables connection is missed.

result = DBselect(
                "select dc.type"
                " from dservices ds, dchecks dc"
                " where ds.dserviceid=" ZBX_FS_UI64,
                event->objectid);

viktors.tjarve RESOLVED in r63000.

sasha connection conditions must be before other conditions

REOPENED

viktors.tjarve SQL query changed to:

result = DBselect(
		"select dc.type"
		" from dservices ds,dchecks dc"
		" where ds.dcheckid=dc.dcheckid"
			" and ds.dserviceid=" ZBX_FS_UI64,
		event->objectid);

RESOLVED in r63018.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(19) [S] src/libs/zbxdbhigh/proxy.c:2497: this function assign values for unused dcheck.key_ and dcheck.type variables

viktors.tjarve Leaving variable dcheck.type because to remove it a new variable has to be declared. Removed assigning value to dcheck.key_.
RESOLVED in r63019.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(20) [IPS] seems proxy_dhistory.key_ and proxy_dhistory.type also can be removed from database

viktors.tjarve RESOLVED in r63015.
Added upgrade patches successfully tested performing upgrade with MySQL DB.

sasha src/zabbix_server/discoverer/discoverer.c:60 this SQL statement is incorrect

DBexecute("insert into proxy_dhistory (clock,druleid,dcheckid,ip,dns,port,value,status)"
                " values (%d," ZBX_FS_UI64 "," ZBX_FS_UI64 ",%d,'%s','%s',%d,'%s',%d)",
                now, drule->druleid, dcheck->dcheckid, ip_esc, dns_esc, port, value_esc, status);

REOPENED

viktors.tjarve RESOLVED in r63041

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(21) [I] deleting of foreign key dservices_1 is unneeded

Database patches 3030003 and 3030010 can be removed

viktors.tjarve RESOLVED in r63015.
Upgrade successfully tested performing upgrade with MySQL DB.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(22) [I] Possible memory leak in DBpatch_3030006(). Call of DBfree_result(result); function can be skipped.

viktors.tjarve RESOLVED in r63017

sasja CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(23) [I] Spaces between file names must be remved

result = DBselect("select dserviceid from dservices"
                " where dserviceid not in (select max(dserviceid) from dservices group by dcheckid, ip, port)");

viktors.tjarve RESOLVED in r63017.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 05 ]

(24) [I] src/libs/zbxdbupgrade/dbupgrade_3030.c:80: useless conversion from string to unit64

ZBX_STR2UINT64(dserviceid, row[0]);

if (ZBX_DB_OK > DBexecute("delete from dservices where dserviceid=" ZBX_FS_UI64, dserviceid))
        return FAIL;

it can be written in such way:

if (ZBX_DB_OK > DBexecute("delete from dservices where dserviceid=%s", row[0]))
        return FAIL;

viktors.tjarve RESOLVED in r63017.

sasha CLOSED

Comment by Viktors Tjarve [ 2016 Oct 06 ]

(25) [S] src/libs/zbxdbhigh/proxy.c:52 type and key_ should be removed from proxy discovery history table declaration after such columns no longer exist in DB.

viktors.tjarve RESOLVED in r63023.

sasha CLOSED

Comment by Alexander Vladishev [ 2016 Oct 09 ]

(26) [I] Have a look at my changes in r63050, r63052

viktors.tjarve Looks good. CLOSED.

Comment by Alexander Vladishev [ 2016 Oct 09 ]

(27) [S] communication between server and proxy is broken

26295:20161009:220103.285 received invalid discovery data from proxy "Zabbix proxy" at "127.0.0.1": Can't find pair with name "type"

sasha RESOLVED in r63051

viktors.tjarve CLOSED.

Comment by Viktors Tjarve [ 2016 Oct 10 ]

Released in:

  • 3.3.0 r63070
Comment by Natalja Romancaka [ 2016 Oct 11 ]

(28) [F] item search by snmp oid does not work, if in filter field "SNMP OID" entered more than 255 characters

oleg.egorov Incorrect DB profiles.value_str size, should be changed to 512

RESOLVED IN r63453

natalja.zabbix search work, but with error

Error in query [UPDATE profiles SET value_str='1.3.6.1.4.1.2636.3.5.2.1.8.31.49.49.48.55.95.102.105.108.116.101.114.45.111.1.3.6.1.4.1.2636.3.5.2.1.8.31.49.49.48.55.95.102.105.108.116.101.114.45.111.1.3.6.1.4.1.2636.3.5.2.1.8.31.49.49.48.55.95.102.105.108.116.101.1.3.6.1.4.1.2636.3.5.2.1.8.31.49.49.551', type=3 WHERE userid=1 AND idx='web.items.filter_snmp_oid'] [Data too long for column 'value_str' at row 1]

oleg.egorov REVERTED changes, will be set search limit 255 characters

RESOLVED in r63459

natalja.zabbix ui tested

gunarspujats CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Nov 23 ]

Fixed in:

  • 3.3.0 r63944
Comment by Martins Valkovskis [ 2016 Nov 23 ]

(29) Looks like database structure internal documentation needs to be updated.

sasha Already updated by viktors.tjarve.

CLOSED

Comment by Javier Barroso [ 2017 Aug 22 ]

Hello, is it posible to backport this fix to 3.2 branch ?

In our case lld snmp_oid field was hit by this issue

Thank you very much

Generated at Thu Apr 25 03:28:18 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.