Source
* These cases cover runtime errors detection in Aggregation and Trends settings combinations found during ZBX-22350.
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__) . '/../../include/CWebTest.php';
/**
* @backup profiles
*
* @onBefore prepareGraphData
*/
class testDataDisplayInGraphs extends CWebTest {
protected static $hostid;
protected static $itemids;
protected static $dashboardid;
const TIMESTAMPS = [
'history' => [
'from' => '2023-10-07 12:58:00',
'to' => '2023-10-07 13:20:00'
],
'trends' => [
'from' => '2023-10-03 00:00:00',
'to' => '2023-10-07 12:00:00'
],
'pie' => [
'from' => 'now-1h',
'to' => 'now'
]
];
public static function prepareGraphData() {
$host_responce = CDataHelper::createHosts([
[
'host' => 'Host for data display on graphs',
'interfaces' => [
[
'type' => INTERFACE_TYPE_AGENT,
'main' => 1,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => '',
'port' => 10051
]
],
'groups' => [
'groupid' => 4 // Host group "Zabbix servers".
],
'status' => HOST_STATUS_MONITORED,
'items' => [
[
'name' => 'Item for history data display 1',
'key_' => 'item_key_1',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'delay' => '1m',
'history' => '9125d',
'trends' => 0
],
[
'name' => 'Item for history data display 2',
'key_' => 'item_key_2',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'delay' => '1m',
'history' => '9125d',
'trends' => 0
],
[
'name' => 'Item for trends data display 1',
'key_' => 'item_key_3',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'delay' => '2h',
'trends' => '9125d'
],
[
'name' => 'Item for trends data display 2',