[ZBX-16702] Error in comparison in the elastic search clearing history function Created: 2019 Sep 30  Updated: 2024 Apr 10  Resolved: 2019 Oct 15

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 4.0.13rc1, 4.2.7rc1, 4.4 (plan)
Fix Version/s: 4.0.14rc1, 4.2.8rc1, 4.4.1rc1, 5.0.0alpha1, 5.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Aleksandrs Subins Assignee: Vasily Goncharenko (Inactive)
Resolution: Fixed Votes: 0
Labels: elasticsearch, history, php7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Capture.PNG    
Team: Team D
Sprint: Sprint 56 (Sep 2019), Sprint 57 (Oct 2019)
Story Points: 0.125

 Description   

The error is reproduced for PHP 7.2.

Steps to reproduce:
1. Configure using Elasticsearch by adding the following lines to zabbix.conf.php:

	global $HISTORY;
         // Elasticsearch url (can be string if same url is used for all types).
         $HISTORY['url']   = [
		    'uint' => 'http://localhost:9200',
		    'text' => 'http://localhost:9200'
         ];
         // Value types stored in Elasticsearch.
         $HISTORY['types'] = ['uint', 'text'];
	

2. Create host;
3. Create any item;
4. Edit this item;
5. Click on button "Clear history and trends"

Result:

Cannot clear history

count(): Parameter must be an array or an object that implements Countable [items.php:910 → CHistoryManager->deleteHistory() → CHistoryManager->deleteHistoryFromElasticsearch() in include\classes\api\managers\CHistoryManager.php:765]
file_get_contents(http://localhost:9200/uint*/values/_delete_by_query?scroll=10s): failed to open stream: No connection could be made because the target machine actively refused it.
[items.php:910 → CHistoryManager->deleteHistory() → CHistoryManager->deleteHistoryFromElasticsearch() → CElasticsearchHelper::query() → CElasticsearchHelper::request() → file_get_contents() in include\classes\helpers\CElasticsearchHelper.php:58]
Elasticsearch error: failed to parse JSON.



 Comments   
Comment by Vasily Goncharenko (Inactive) [ 2019 Oct 01 ]

Fixed in development branch feature/ZBX-16702-4.0

Comment by Vasily Goncharenko (Inactive) [ 2019 Oct 10 ]

Fixed in:

  • 4.0.14rc1 a8c6088ac63
  • 4.2.8rc1 1ed605d76fe
  • 4.4.1rc1 a9d372c64d1
  • 5.0.0alpha1(master) b9d9dd00b7e
Generated at Sat Aug 02 13:27:35 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.