Source
$monthid = CDBHelper::getValue('SELECT eventid FROM problem WHERE name='.zbx_dbstr('Trigger for Age problem 1 month'));
<?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';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
require_once dirname(__FILE__).'/../behaviors/CTagBehavior.php';
/**
* @backup profiles
*
* @onBefore prepareProblemsData
*
* @dataSource UserPermissions, WidgetCommunication
*/
class testPageProblems extends CWebTest {
/**
* Attach TagBehavior and TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CTableBehavior::class,
[
'class' => CTagBehavior::class,
'tag_selector' => 'id:filter-tags_0'
]
];
}
protected static $time;
public function prepareProblemsData() {
/**
* Change refresh interval so Problems page doesn't refresh automatically,
* and popup dialogs don't disappear.
*/
DBexecute('UPDATE users SET refresh=999 WHERE username='.zbx_dbstr('Admin'));
// Create host group for hosts with item and trigger.
$hostgroups = CDataHelper::call('hostgroup.create', [['name' => 'Group for Problems Page']]);
// Create host.
$result = CDataHelper::createHosts([
[
'host' => 'Host for Problems Page',
'groups' => [['groupid' => $hostgroups['groupids'][0]]],
'items' => [
[