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/>.
**/
require_once dirname(__FILE__).'/common/testAuditlogCommon.php';
/**
* @backup maintenances
*/
class testAuditlogMaintenance extends testAuditlogCommon {
/**
* Existing Maintenance ID.
*/
private const MAINTENANCEID = 60002;
public function testAuditlogMaintenance_Create() {
$create = $this->call('maintenance.create', [
[
'name' => 'audit_maintenance',
'active_since' => 1358844540,
'active_till' => 1390466940,
'tags_evaltype' => 0,
'groups' => [
'groupid' => 2
],
'timeperiods' => [
[
'period' => 3600,
'timeperiod_type' => 3,
'start_time' => 64800,
'every' => 1,
'dayofweek' => 64
]
],
'tags' => [
[
'tag' => 'audit',
'operator' => 0,
'value' => 'details'
]
]
]
]);
$resourceid = $create['result']['maintenanceids'][0];
$groupid = CDBHelper::getRow('SELECT maintenance_groupid FROM maintenances_groups WHERE maintenanceid='.
zbx_dbstr($resourceid)
);
$timeperiod = CDBHelper::getRow('SELECT timeperiodid FROM timeperiods ORDER BY timeperiodid DESC');
$tags = CDBHelper::getRow('SELECT maintenancetagid FROM maintenance_tag WHERE maintenanceid='.zbx_dbstr($resourceid));