Source
int get_function_parameter_period(const char *parameters, int Nparam, int *value, zbx_value_type_t *type)
/*
** 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/>.
**/
int get_function_parameter_uint64(const char *parameters, int Nparam, zbx_uint64_t *value)
{
char *parameter;
int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() parameters:'%s' Nparam:%d", __func__, parameters, Nparam);
if (NULL == (parameter = zbx_function_get_param_dyn(parameters, Nparam)))
goto out;
if (SUCCEED == (ret = zbx_is_uint64(parameter, value)))
zabbix_log(LOG_LEVEL_DEBUG, "%s() value:" ZBX_FS_UI64, __func__, *value);
zbx_free(parameter);
out:
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret));
return ret;
}
int get_function_parameter_float(const char *parameters, int Nparam, unsigned char flags, double *value)
{
char *parameter;
int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() parameters:'%s' Nparam:%d", __func__, parameters, Nparam);
if (NULL == (parameter = zbx_function_get_param_dyn(parameters, Nparam)))
goto out;
if (SUCCEED == (ret = zbx_is_double_suffix(parameter, flags)))
{
*value = zbx_str2double(parameter);
zabbix_log(LOG_LEVEL_DEBUG, "%s() value:" ZBX_FS_DBL, __func__, *value);
}
zbx_free(parameter);
out:
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret));
return ret;
}
int get_function_parameter_str(const char *parameters, int Nparam, char **value)
{
int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() parameters:'%s' Nparam:%d", __func__, parameters, Nparam);
if (NULL == (*value = zbx_function_get_param_dyn(parameters, Nparam)))
goto out;
zabbix_log(LOG_LEVEL_DEBUG, "%s() value:'%s'", __func__, *value);
ret = SUCCEED;
out:
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret));
return ret;
}
/******************************************************************************
* *
* Purpose: get the value of sec|num + timeshift trigger function parameter. *
* *
* Parameters: from - [IN] function calculation time *
* parameters - [IN] trigger function parameters *
* Nparam - [IN] specifies which parameter to extract *
* value - [OUT] parameter value (preserved as is if the *
* parameter is optional and empty) *