<?php
require_once __DIR__.'/../common/testLowLevelDiscovery.php';
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',
'query_fields' => [['name' => 'test_name1', 'value' => 'value1'], ['name' => '2', 'value' => 'value2']],
'request_method' => HTTPCHECK_REQUEST_HEAD,
'post_type' => ZBX_POSTTYPE_JSON,
'posts' => '{"zabbix_export": {"version": "6.0","date": "2024-03-20T20:05:14Z"}}',
'headers' => [['name' => 'name1', 'value' => 'value']],
'status_codes' => '400, 600',
'follow_redirects' => 1,
'retrieve_mode' => 1,
'http_proxy' => '161.1.1.5',
'authtype' => ZBX_HTTP_AUTH_NTLM,
'username' => 'user',
'password' => 'pass',
'verify_peer' => ZBX_HTTP_VERIFY_PEER_ON,
'verify_host' => ZBX_HTTP_VERIFY_HOST_ON,
'ssl_cert_file' => '/home/test/certdb/ca.crt',
'ssl_key_file' => '/home/test/certdb/postgresql-server.crt',
'ssl_key_password' => '/home/test/certdb/postgresql-server.key',
'timeout' => '10s',
'lifetime_type' => ZBX_LLD_DELETE_AFTER,
'lifetime' => '15d',
'enabled_lifetime_type' => ZBX_LLD_DISABLE_NEVER,
'allow_traps' => HTTPCHECK_ALLOW_TRAPS_ON,
'trapper_hosts' => '127.0.2.3',
'description' => 'LLD for test',
'preprocessing' => [['type' => ZBX_PREPROC_STR_REPLACE, 'params' => "a\nb"]],
'lld_macro_paths' => ['lld_macro' => '{#MACRO}', 'path' => '$.path'],
'filter' => [
'evaltype' => CONDITION_EVAL_TYPE_AND_OR,