Source
'\'PROBLEM: Value of item key1 > 10\', \'Event at 2012.02.20 10:00:30 Hostname: H1 Value of item key1 > 10: PROBLEM\','.
<?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 Actions {
const ZABBIX_ADMIN_GROUPID = 7;
const ADMIN_USERID = 1;
const EMAIL_MEDIATYPEID = 1;
const CURRENT_HOST = 0;
/**
* Create data for all Actions related tests (also used in Media types, Reports and Services tests, etc).
*
* @return array
*/
public static function load() {
CDataHelper::call('proxy.create',
[
[
'name' => 'Proxy for Actions 1',
'operating_mode' => PROXY_OPERATING_MODE_ACTIVE
],
[
'name' => 'Proxy for Actions 2',
'operating_mode' => PROXY_OPERATING_MODE_ACTIVE
]
]
);
$proxyids = CDataHelper::getIds('name');
$scripts = CDataHelper::call('script.create', [
[
'name' => 'Reboot',
'type' => ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT,
'scope' => ZBX_SCRIPT_SCOPE_ACTION,
'command' => '/sbin/shutdown -r',
'groupid' => 4, // Zabbix servers.
'description' => 'This command reboots server.'
]
]);
$reboot_scriptid = $scripts['scriptids'][0];
CDataHelper::call('action.create', [
// Service action.
[
'name' => 'Service action',
'eventsource' => EVENT_SOURCE_SERVICE,
'filter' => [
'evaltype' => CONDITION_EVAL_TYPE_AND_OR,
'conditions' => [