Source
* Check if function is aggregating wildcarded host/item queries and is exclusive to calculated item formulas.
<?php declare(strict_types = 1);
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* Class containing information on history functions.
*/
final class CHistFunctionData {
public const PERIOD_MODE_DEFAULT = 0;
public const PERIOD_MODE_SEC = 1;
public const PERIOD_MODE_SEC_ONLY = 2;
public const PERIOD_MODE_NUM_ONLY = 3;
public const PERIOD_MODE_TREND = 4;
/**
* Known history functions along with definition of parameters.
*
* @var array
*/
private const PARAMETERS = [
'avg' => [
['rules' => [['type' => 'query']]],
['rules' => [['type' => 'period', 'mode' => self::PERIOD_MODE_DEFAULT]]]
],
'avg_foreach' => [
['rules' => [['type' => 'query']]],
['rules' => [['type' => 'period', 'mode' => self::PERIOD_MODE_SEC_ONLY]]]
],
'bucket_percentile' => [
['rules' => [['type' => 'query']]],
['rules' => [['type' => 'period', 'mode' => self::PERIOD_MODE_SEC_ONLY]]],
['rules' => [
['type' => 'regexp', 'pattern' => '/^((\d+(\.\d{0,4})?)|(\.\d{1,4}))$/'],
['type' => 'number', 'min' => 0, 'max' => 100]
]]
],
'bucket_rate_foreach' => [
['rules' => [['type' => 'query']]],
['rules' => [['type' => 'period', 'mode' => self::PERIOD_MODE_SEC_ONLY]]],
['rules' => [
['type' => 'regexp', 'pattern' => '/^\d+$/'],
['type' => 'number', 'min' => 1]
], 'required' => false]
],
'change' => [