Source
/*
** 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.
**/
extern unsigned char program_type;
/******************************************************************************
* *
* Purpose: retrieve data from Zabbix agent *
* *
* Parameters: item - item we are interested in *
* *
* Return value: SUCCEED - data successfully retrieved and stored in result *
* and result_str (as string) *
* NETWORK_ERROR - network related error occurred *
* NOTSUPPORTED - item not supported by the agent *
* AGENT_ERROR - uncritical error on agent side occurred *
* FAIL - otherwise *
* *
* Comments: error will contain error message *
* *
******************************************************************************/
int get_value_agent(const DC_ITEM *item, AGENT_RESULT *result)
{
zbx_socket_t s;
const char *tls_arg1, *tls_arg2;
int ret = SUCCEED;
ssize_t received_len;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() host:'%s' addr:'%s' key:'%s' conn:'%s'", __func__, item->host.host,
item->interface.addr, item->key, zbx_tcp_connection_type_name(item->host.tls_connect));
switch (item->host.tls_connect)
{
case ZBX_TCP_SEC_UNENCRYPTED:
tls_arg1 = NULL;
tls_arg2 = NULL;
break;
case ZBX_TCP_SEC_TLS_CERT:
tls_arg1 = item->host.tls_issuer;