require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/hosts.inc.php';
require_once dirname(__FILE__).'/include/items.inc.php';
require_once dirname(__FILE__).'/include/forms.inc.php';
$page['title'] = _('Configuration of discovery rules');
$page['file'] = 'host_discovery.php';
$page['scripts'] = ['multilineinput.js', 'items.js'];
require_once dirname(__FILE__).'/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(getRequest('type', 0));
CONDITION_EVAL_TYPE_AND_OR,
CONDITION_EVAL_TYPE_EXPRESSION
'hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form}) && !isset({itemid})'],
'itemid' => [T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form}) && ({form} == "update"))'],
'interfaceid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')],
'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')],
'description' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'],
'key' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Key')],
'master_itemid' => [T_ZBX_STR, O_OPT, null, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && {type} == '.ITEM_TYPE_DEPENDENT,
'delay' => [T_ZBX_TU, O_OPT, P_ALLOW_USER_MACRO, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && {type} != '.ITEM_TYPE_TRAPPER.' && {type} != '.ITEM_TYPE_SNMPTRAP.
' && {type} != '.ITEM_TYPE_DEPENDENT.
' && !({type} == '.ITEM_TYPE_ZABBIX_ACTIVE.
' && isset({key}) && strncmp({key}, "mqtt.get", 8) === 0)',
'delay_flex' => [T_ZBX_STR, O_OPT, P_ONLY_TD_ARRAY, null, null],
'status' => [T_ZBX_INT, O_OPT, null, IN(ITEM_STATUS_ACTIVE), null],
'type' => [T_ZBX_INT, O_OPT, null,
IN([-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_INTERNAL,
ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR,
ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX,
ITEM_TYPE_DEPENDENT, ITEM_TYPE_HTTPAGENT, ITEM_TYPE_SNMP, ITEM_TYPE_SCRIPT
'isset({add}) || isset({update})'
'authtype' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD.','.ITEM_AUTHTYPE_PUBLICKEY),
'(isset({add}) || isset({update})) && isset({type}) && {type} == '.ITEM_TYPE_SSH],
'username' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY,
'(isset({add}) || isset({update})) && isset({type})'.
' && '.IN(ITEM_TYPE_SSH.','.ITEM_TYPE_TELNET, 'type'),
'password' => [T_ZBX_STR, O_OPT, null, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && '.IN(ITEM_TYPE_SSH.','.ITEM_TYPE_TELNET, 'type')
'publickey' => [T_ZBX_STR, O_OPT, null, null,
'(isset({add}) || isset({update})) && isset({type}) && {type} == '.ITEM_TYPE_SSH.
' && {authtype} == '.ITEM_AUTHTYPE_PUBLICKEY
'privatekey' => [T_ZBX_STR, O_OPT, null, null,
'(isset({add}) || isset({update})) && isset({type}) && {type} == '.ITEM_TYPE_SSH.
' && {authtype} == '.ITEM_AUTHTYPE_PUBLICKEY