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 __DIR__.'/../common/testLowLevelDiscovery.php';
/**
* @onBefore prepareLLDTemplateData
*
* @onAfter deleteData
*/
class testFormLowLevelDiscoveryFromTemplate extends testLowLevelDiscovery {
protected static $groupid;
protected static $templateid;
protected static $context = 'template';
protected static $update_lld = 'LLD for update scenario';
public function prepareLLDTemplateData() {
static::$groupid = CDataHelper::call('templategroup.create', [['name' => 'Template group for lld']])['groupids'][0];
$templates = CDataHelper::createTemplates([
[
'host' => 'Template with LLD',
'groups' => ['groupid' => static::$groupid],
'items' => [
[
'name' => 'Master item',
'key_' => 'master.test',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_UINT64
]
],
'discoveryrules' => [
[
'name' => 'LLD for update scenario',
'key_' => 'vfs.fs.discovery1',
'type' => ITEM_TYPE_ZABBIX,
'delay' => 30
],
[
'name' => 'LLD for delete scenario',
'key_' => 'vfs.fs.discovery2',
'type' => ITEM_TYPE_ZABBIX,
'delay' => 30
],
[
'name' => self::SIMPLE_UPDATE_CLONE_LLD,
'key_' => 'simple_update_clone_key',
'type' => ITEM_TYPE_HTTPAGENT,
'delay' => '1h;wd1-2h7-14',
'url' => 'https://www.test.com/search',