Source
CDBHelper::setTriggerProblem(array_keys($triggerids), TRIGGER_VALUE_TRUE, ['clock' => $item_data_timestamp]);
<?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 WidgetCommunication {
const FIRST_HOST_NAME = '1st host for widgets';
const SECOND_HOST_NAME = '2nd host for widgets';
const THIRD_HOST_NAME = '3rd host for widgets';
const FIRST_HOSTGROUP_NAME = '1st hostgroup for widgets';
const SECOND_HOSTGROUP_NAME = '2nd hostgroup for widgets';
const THIRD_HOSTGROUP_NAME = '3rd hostgroup for widgets';
const FIRST_HOST_TRIGGER = 'trigger on host 1';
const SECOND_HOST_TRIGGER = 'trigger on host 2';
const THIRD_HOST_TRIGGER = 'trigger on host 3';
const MAP_NAME = 'Map for testing feedback';
const SUBMAP_NAME = 'Map for widget communication test';
public static function load() {
// Create host groups.
CDataHelper::call('hostgroup.create', [
['name' => self::FIRST_HOSTGROUP_NAME],
['name' => self::SECOND_HOSTGROUP_NAME],
['name' => self::THIRD_HOSTGROUP_NAME]
]);
$host_groupids = CDataHelper::getIds('name');
// Create hosts.
$host_response = CDataHelper::createHosts([
[
'host' => self::FIRST_HOST_NAME,
'interfaces' => [
'type' => INTERFACE_TYPE_AGENT,
'main' => INTERFACE_PRIMARY,
'useip' => INTERFACE_USE_IP,
'ip' => '127.0.0.1',
'dns' => '',
'port' => 10050
],
'groups' => [
'groupid' => $host_groupids[self::FIRST_HOSTGROUP_NAME]
],
'inventory_mode' => 0,
'inventory' => [
'location_lat' => '59.4370',
'location_lon' => '24.7536'
],
'status' => HOST_STATUS_MONITORED,
'tags' => [
[
'tag' => 'widget',