[ZBX-15812] item.get are listing an empty itemDiscovery[] array when using selectItemDiscovery Created: 2019 Mar 13  Updated: 2019 Apr 03  Resolved: 2019 Apr 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Frontend (F)
Affects Version/s: 4.0.5
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Aigars Kadikis Assignee: Zabbix Development Team
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File LLD-item-is-not-discovered-anymore.xml     PNG File image-2019-03-13-15-34-26-232.png     File response-3.4.15.json     File response.json    
Issue Links:
Sub-task

 Description   

Steps to reproduce

Link LLD-item-is-not-discovered-anymore.xml template to host "Zabbix server" and reload configuration cache:

zabbix_server -R config_cache_reload

Send two traps:

zabbix_sender -z 127.0.0.1 -s "Zabbix server" -k lld.trap -o '{"data":[{"{#VAR}":"one"},{"{#VAR}":"two"}]}'
zabbix_sender -z 127.0.0.1 -s "Zabbix server" -k lld.trap -o '{"data":[{"{#VAR}":"one"},{"{#VAR}":"three"}]}'

Go to Zabbix server items and filter application "var". Observe if one of the items is not discovered anymore:

Let's try to identify this via API by using selectItemDiscovery query:

{
	"jsonrpc": "2.0",
	"method": "item.get",
	"params": {

		"selectItemDiscovery": "query",
		"search": {
			"key_": "key"
		},

		"output": "extend",
		"hostids": "10084",
		"sortfield": "name"

	},
	"auth": "e8e040ac9dc043aa6045acd180703061",
	"id": 1
}

The following response.json shows 3 items but the array itemDiscovery[] is empty.

Expected

Based on the documentation page itemDiscovery must show attributes:

  • lastcheck - (timestamp) time when the item was last discovered;
  • ts_delete - (timestamp) time when an item that is no longer discovered will be deleted.

.. and more



 Comments   
Comment by Aigars Kadikis [ 2019 Apr 03 ]

The problem was missing details in the API call.

To identify the items which will be deleted soon I need to specify lastcheck and ts_delete in for selectItemDiscovery parameter, like: 

{
	"jsonrpc": "2.0",
	"method": "item.get",
	"params": {

		"selectItemDiscovery": ["lastcheck","ts_delete"],
		"search": {
			"key_": "key"
		},

		"hostids": "10084",
		"sortfield": "name"

	},
	"auth": "671e70355f04b20c0ecbf28bdb648233",
	"id": 1
} 
Generated at Fri Apr 18 13:49:11 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.