Source
xxxxxxxxxx
int rtc_process_request_ex_server(zbx_rtc_t *rtc, zbx_uint32_t code, const unsigned char *data, char **result)
/*
** 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/>.
**/
static int rtc_parse_options_server(const char *opt, zbx_uint32_t *code, struct zbx_json *j, char **error)
{
const char *param;
if (0 == strcmp(opt, ZBX_SECRETS_RELOAD))
{
*code = ZBX_RTC_SECRETS_RELOAD;
return SUCCEED;
}
if (0 == strcmp(opt, ZBX_SERVICE_CACHE_RELOAD))
{
*code = ZBX_RTC_SERVICE_CACHE_RELOAD;
return SUCCEED;
}
if (0 == strcmp(opt, ZBX_TRIGGER_HOUSEKEEPER_EXECUTE))
{
*code = ZBX_RTC_TRIGGER_HOUSEKEEPER_EXECUTE;
return SUCCEED;
}
if (0 == strcmp(opt, ZBX_HA_STATUS))
{
*code = ZBX_RTC_HA_STATUS;
return SUCCEED;
}
if (0 == strncmp(opt, ZBX_HA_REMOVE_NODE, ZBX_CONST_STRLEN(ZBX_HA_REMOVE_NODE)))
{
param = opt + ZBX_CONST_STRLEN(ZBX_HA_REMOVE_NODE);
if ('=' == *param)
{
*code = ZBX_RTC_HA_REMOVE_NODE;
zbx_json_addstring(j, ZBX_PROTO_TAG_NODE, param + 1, ZBX_JSON_TYPE_STRING);
return SUCCEED;
}
if ('\0' == *param)
{
*error = zbx_strdup(NULL, "missing node cuid or name parameter");
return FAIL;
}
/* not ha_remove_node runtime control option */
}
if (0 == strncmp(opt, ZBX_HA_SET_FAILOVER_DELAY, ZBX_CONST_STRLEN(ZBX_HA_SET_FAILOVER_DELAY)))
{
int delay;
param = opt + ZBX_CONST_STRLEN(ZBX_HA_SET_FAILOVER_DELAY);
if ('=' == *param)
{
if (SUCCEED == zbx_is_time_suffix(param + 1, &delay, ZBX_LENGTH_UNLIMITED))
{
if (delay < 10 || delay > 15 * SEC_PER_MIN)
{
*error = zbx_strdup(NULL, "failover delay must be in range from 10s to 15m");
return FAIL;
}
*code = ZBX_RTC_HA_SET_FAILOVER_DELAY;