Source
* Sort steps and prioritize ZBX_PREPROC_VALIDATE_NOT_SUPPORTED checks, with "match any error" being the last of them.
<?php declare(strict_types = 0);
/*
** 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/>.
**/
class CItemGeneralHelper {
/**
* Get item fields default values.
*/
public static function getDefaults(): array {
// Default script value for browser type items.
$browser_script = <<<'JAVASCRIPT'
var browser = new Browser(Browser.chromeOptions());
try {
browser.navigate("https://example.com");
browser.collectPerfEntries();
}
finally {
return JSON.stringify(browser.getResult());
}
JAVASCRIPT;
return [
'allow_traps' => DB::getDefault('items', 'allow_traps'),
'authtype' => DB::getDefault('items', 'authtype'),
'browser_script' => $browser_script,
'custom_timeout' => ZBX_ITEM_CUSTOM_TIMEOUT_DISABLED,
'delay_flex' => [],
'delay' => ZBX_ITEM_DELAY_DEFAULT,
'description' => DB::getDefault('items', 'description'),
'discovered' => false,
'follow_redirects' => DB::getDefault('items', 'follow_redirects'),
'headers' => [],
'history_mode' => ITEM_STORAGE_CUSTOM,
'history' => DB::getDefault('items', 'history'),
'hostid' => 0,
'http_authtype' => ZBX_HTTP_AUTH_NONE,
'http_password' => '',
'http_proxy' => DB::getDefault('items', 'http_proxy'),
'http_username' => '',
'interfaceid' => 0,
'ipmi_sensor' => DB::getDefault('items', 'ipmi_sensor'),
'itemid' => 0,
'jmx_endpoint' => ZBX_DEFAULT_JMX_ENDPOINT,
'key' => '',
'logtimefmt' => DB::getDefault('items', 'logtimefmt'),
'master_itemid' => 0,
'master_item' => [],
'name' => '',
'output_format' => DB::getDefault('items', 'output_format'),