Source
DBexecute('INSERT INTO trigger_discovery (triggerid, parent_triggerid, lastcheck, ts_delete, disable_source, ts_disable, status) VALUES ('.
<?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';
/**
* Test checks the objects created by LLD and then no more discovered or/and disabled.
*
* @backup hstgrp
*
* @onBefore prepareLLDData
*/
class testLowLevelDiscoveryDisabledObjects extends CWebTest {
const HINT_HOST = 'Host for LLD hint';
protected static $hint_hostid;
public static function prepareLLDData() {
// Create hostgroup for hosts with LLD.
$hostgroupid = CDataHelper::call('hostgroup.create', [['name' => 'Group for LLD hint']])['groupids'][0];
// Create hosts with low level discovery.
$hosts = CDataHelper::createHosts([
[
'host' => self::HINT_HOST,
'groups' => [['groupid' => $hostgroupid]],
'discoveryrules' => [
[
'name' => '1 Delete - never, disable - never',
'key_' => 'rule1',
'type' => ITEM_TYPE_TRAPPER,
'lifetime_type' => ZBX_LLD_DELETE_NEVER,
'enabled_lifetime_type' => ZBX_LLD_DISABLE_NEVER
],
[
'name' => '2 Delete - never, disable - immediately',
'key_' => 'rule2',
'type' => ITEM_TYPE_TRAPPER,
'lifetime_type' => ZBX_LLD_DELETE_NEVER,
'enabled_lifetime_type' => ZBX_LLD_DISABLE_IMMEDIATELY
],
[
'name' => '3 Delete - never, disable - after 2w',
'key_' => 'rule3',
'type' => ITEM_TYPE_TRAPPER,
'lifetime_type' => ZBX_LLD_DELETE_NEVER,
'enabled_lifetime_type' => ZBX_LLD_DISABLE_AFTER,
'enabled_lifetime' => '2w'
],