Source
zbx_uint32_t zbx_connector_pack_top_connectors_result(unsigned char **data, zbx_connector_stat_t **connector_stats,
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
static int connector_initialized;
void zbx_connector_init(void)
{
connector_initialized = CONNECTOR_INITIALIZED_YES;
}
int zbx_connector_initialized(void)
{
if (CONNECTOR_INITIALIZED_YES != connector_initialized)
return FAIL;
return SUCCEED;
}
void zbx_connector_send(zbx_uint32_t code, unsigned char *data, zbx_uint32_t size)
{
static zbx_ipc_socket_t socket;
if (CONNECTOR_INITIALIZED_YES != connector_initialized)
{
zabbix_log(LOG_LEVEL_DEBUG, "connector is not initialized: please check \"StartConnectors\""
" configuration parameter");
return;
}
/* each process has a permanent connection to connector manager */
if (0 == socket.fd)
{
char *error = NULL;
if (FAIL == zbx_ipc_socket_open(&socket, ZBX_IPC_SERVICE_CONNECTOR, SEC_PER_MIN, &error))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot connect to connector manager service: %s", error);
exit(EXIT_FAILURE);