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 ExecuteNowAction {
/**
* Create data for "Execute now" action testing.
*
* @return array
*/
public static function load() {
// Create host group.
CDataHelper::call('hostgroup.create', [
['name' => 'HG-for-executenow']
]);
$hostgroupids = CDataHelper::getIds('name');
// Create host.
$hosts = CDataHelper::createHosts([
[
'host' => 'Host for execute now permissions',
'interfaces' => [
[
'type' => 1,
'main' => 1,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => '',
'port' => '10051'
]
],
'groups' => [
'groupid' => $hostgroupids['HG-for-executenow']
],
'status' => HOST_STATUS_MONITORED,
'items' => [
[
'name' => 'I1-lvl1-agent-num',
'key_' => 'I1-lvl1-agent-num',
'type' => ITEM_TYPE_ZABBIX,
'value_type' => ITEM_VALUE_TYPE_UINT64,
'delay' => '1h'
],
[
'name' => 'I2-lvl1-trap-num',
'key_' => 'I2-lvl1-trap-num',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_UINT64
],
[
'name' => 'I4-trap-log',