Source
// Get values of item of value_type == ITEM_VALUE_TYPE_UINT64 ('history' => 3) using time range selector.
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__).'/../include/CAPITest.php';
class testHistory extends CAPITest {
public static function history_get_data() {
return [
// Test item history of value_type == ITEM_VALUE_TYPE_STR ('history' => 1).
[
'api_request' => [
'output' => 'extend',
'history' => 1,
'itemids' => ['133760']
],
'expected_result' => [
[
'itemid' => '133760',
'clock' => '1549350960',
'value' => '1',
'ns' => '754460948'
],
[
'itemid' => '133760',
'clock' => '1549350962',
'value' => '1',
'ns' => '919404393'
],
[
'itemid' => '133760',
'clock' => '1549350965',
'value' => '1',
'ns' => '512878374'
]
],
'expected_error' => false
],
// Test item history of value_type == ITEM_VALUE_TYPE_LOG ('history' => 2).
[
'api_request' => [
'output' => ['value', 'severity'],
'history' => 2,
'itemids' => ['133761']
],