[ZBXNEXT-3652] Network discovery crop value to 255 chars Created: 2016 May 25  Updated: 2017 Mar 01

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Installation (I), Server (S)
Affects Version/s: 3.4.0alpha1
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Patrick Brideau Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: networkdiscovery
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When querying key from the discoverer, the value get truncated to 255 chars.

I found this when creating a custom userparameter returning every puppet classes (seperated by comma) to automaticaly add template to a host. See http://serverfault.com/questions/778805/zabbix-network-discovery-of-puppet-managed-network/778876

Values got truncated as so:

[zabbix]> select dserviceid,dhostid,status,lastup,lastdown,value,dns from dservices where dcheckid=3 and type=9 and key_='puppet.classes' \G
*************************** 1. row ***************************
dserviceid: 9
   dhostid: 3
    status: 0
    lastup: 1464103581
  lastdown: 0
     value: ,apache,apache::default_confd_files,apache::default_mods,apache::mod::alias,apache::mod::dir,apache::mod::filter,apache::mod::mime,apache::mod::php,apache::mod::prefork,apache::mod::ssl,apache::mod::status,apache::params,apache::service,apache::version,ap
       dns: 
src/libs/zbxdbhigh/discovery.c
  static void discovery_update_dservice(zbx_uint64_t dserviceid, int status, int lastup, int lastdown, const char *value)
  {
      char    *value_esc;
      value_esc = DBdyn_escape_string_len(value, DSERVICE_VALUE_LEN);
      DBexecute("update dservices set status=%d,lastup=%d,lastdown=%d,value='%s' where dserviceid=" ZBX_FS_UI64, status, lastup, lastdown, value_esc, dserviceid);

      zbx_free(value_esc);
  }
include/db.h
  #define DSERVICE_VALUE_LEN        255


 Comments   
Comment by Patrick Brideau [ 2016 May 25 ]

It seems the auto-registration metadata value have the same limitation of 255 chars

Comment by Glebs Ivanovskis (Inactive) [ 2017 Jan 08 ]

I moved this request into ZBXNEXT project because it's a database limitation and we can only fix it in a major release.

Comment by richlv [ 2017 Feb 28 ]

with postgresql, this results in errors :

ERROR:  value too long for type character varying(255)
STATEMENT:  update dservices set status=0,lastup=1488280308,lastdown=0,value='...long_value...' where dserviceid=1234

should this be moved back to ZBX ?

Comment by Glebs Ivanovskis (Inactive) [ 2017 Feb 28 ]

Dear richlv, I will not ask you to reveal the "long value", but please give us some information about it:

  1. number of characters;
  2. number of bytes;
  3. number of LF and CR characters;
  4. presence of non-ASCII characters and original encoding.

Also please provide some general information:

  1. version of Zabbix being used;
  2. Zabbix database character set.
Comment by richlv [ 2017 Mar 01 ]

taking one case as an example - others differ somewhat in size, but not much.

1. 546 characters
2. 546 bytes
3. 7 LFs
4. no non-ascii chars; value obtained by agent from a script, agent locale - en_US.UTF-8

1. this specific case on 2.4.6
2. utf8

Comment by Glebs Ivanovskis (Inactive) [ 2017 Mar 01 ]

Hmm, this piece of 2.4 code is suspicious:

		/* only UTF-8 characters should reduce a variable max_src_len */
		if (0x80 != (0xc0 & *s) && 0 == --max_src_len)
			break;

But I don't think that the issue affects latest supported versions.

Generated at Fri Apr 26 03:04:44 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.