Source
ret = zbx_ipc_async_exchange(ZBX_IPC_SERVICE_HA, cmd, ZBX_HA_SERVICE_TIMEOUT, NULL, 0, &result, error);
/*
** 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/>.
**/
/******************************************************************************
* *
* Purpose: get HA nodes in json format *
* *
******************************************************************************/
int zbx_ha_get_nodes(char **nodes, char **error)
{
unsigned char *data, *ptr;
zbx_uint32_t str_len;
int ret;
char *str;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
if (SUCCEED != zbx_ipc_async_exchange(ZBX_IPC_SERVICE_HA, ZBX_IPC_SERVICE_HA_GET_NODES,
ZBX_HA_SERVICE_TIMEOUT, NULL, 0, &data, error))
{
return FAIL;
}
ptr = data;
ptr += zbx_deserialize_value(ptr, &ret);
(void)zbx_deserialize_str(ptr, &str, str_len);
zbx_free(data);
if (SUCCEED == ret)
*nodes = str;
else
*error = str;
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret));
return ret;
}
/******************************************************************************
* *
* Purpose: remove HA node *
* *
* Comments: A new socket is opened to avoid interfering with notification *
* channel *
* *
******************************************************************************/