Source
<?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/>.
**/
class ItemValueWidget {
public static function load() {
// Create host for aggregation data tests.
$hosts = CDataHelper::createHosts([
[
'host' => 'Simple host with items for item value widget test',
'interfaces' => [
[
'type' => INTERFACE_TYPE_AGENT,
'main' => INTERFACE_PRIMARY,
'useip' => INTERFACE_USE_IP,
'ip' => '127.0.9.7',
'dns' => '',
'port' => '10011'
]
],
'groups' => [
'groupid' => '4' // 'Zabbix servers' group.
],
'items' => [
[
'name' => 'Item with type of information - numeric (float)',
'key_' => 'numeric_float',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'delay' => '30'
],
[
'name' => 'Item with type of information - Character',
'key_' => 'character',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_STR,
'delay' => '30'
],
[
'name' => 'Item with type of information - Log',
'key_' => 'log',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_LOG,
'delay' => '30'
],
[
'name' => 'Item with type of information - numeric (unsigned)',
'key_' => 'numeric_unsigned',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_UINT64,
'delay' => '30'
],
[
'name' => 'Item with type of information - Text',
'key_' => 'text',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_TEXT,
'delay' => '30'
],
[
'name' => 'Item with units',
'key_' => 'vm.memory.size[pavailable]',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'units' => '%',
'delay' => '30'
]
]
],
[
'host' => 'Host for valuemapping test',
'interfaces' => [
[
'type' => INTERFACE_TYPE_AGENT,
'main' => INTERFACE_PRIMARY,
'useip' => INTERFACE_USE_IP,
'ip' => '127.0.9.8',
'dns' => '',