Source
'error' => 'Invalid parameter "/1/preprocessing/1/type": value must be one of 5, 11, 12, 14, 15, 16, 17, 20, 21, 23, 24, 25, 27, 28, 29, 30.'
<?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__.'/../include/CAPITest.php';
require_once __DIR__.'/../include/helpers/CDataHelper.php';
require_once __DIR__.'/../include/helpers/CTestDataHelper.php';
/**
* @onBefore prepareTestData
* @onAfter cleanTestData
*/
class testItemPreprocessing extends CAPITest {
private const NS_STEP_FIELDS = [
'type' => ZBX_PREPROC_VALIDATE_NOT_SUPPORTED,
'error_handler' => ZBX_PREPROC_FAIL_DISCARD_VALUE,
'error_handler_params' => ''
];
public static function prepareTestData(): void {
CTestDataHelper::createObjects([
'template_groups' => [
['name' => 'tg.preprocessing']
],
'templates' => [
[
'host' => 'test.ns.create',
'lld_rules' => [
['key_' => 'test.ns.create.rule']
]
],
[
'host' => 'item.verify.ns.sorting',
'items' => [
[
'key_' => 'ssh.item.sorted',
'type' => ITEM_TYPE_SSH,
'username' => 'username',
'params' => 'service mysql-server status',
'delay' => '1m',
'preprocessing' => [
['params' => ZBX_PREPROC_MATCH_ERROR_REGEX."\n".'A'] + self::NS_STEP_FIELDS,
['params' => ZBX_PREPROC_MATCH_ERROR_REGEX."\n".'{$MACRO}'] + self::NS_STEP_FIELDS,
['params' => ZBX_PREPROC_MATCH_ERROR_REGEX."\n".'B'] + self::NS_STEP_FIELDS,
[
'type' => ZBX_PREPROC_TRIM,
'params' => ' ',
'error_handler' => DB::getDefault('item_preproc', 'error_handler'),
'error_handler_params' => DB::getDefault('item_preproc', 'error_handler_params')
],