Source
xxxxxxxxxx
static int macro_httptest_field_resolv(zbx_macro_resolv_data_t *p, va_list args, char **replace_with, char **data,
/*
** 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/>.
**/
typedef struct
{
long rspcode;
double total_time;
curl_off_t speed_download;
}
zbx_httpstat_t;
/* HAVE_LIBCURL */
/******************************************************************************
* *
* Purpose: removes all macro variables cached during HTTP test execution *
* *
* Parameters: httptest - [IN] HTTP test data *
* *
******************************************************************************/
static void httptest_remove_macros(zbx_httptest_t *httptest)
{
for (int i = 0; i < httptest->macros.values_num; i++)
{
zbx_ptr_pair_t *pair = &httptest->macros.values[i];
zbx_free(pair->first);
zbx_free(pair->second);
}
zbx_vector_ptr_pair_clear(&httptest->macros);
}
/* HTTP item types */
static void process_test_data(zbx_uint64_t httptestid, int lastfailedstep, double speed_download,
const char *err_str, zbx_timespec_t *ts)
{
zbx_db_result_t result;
zbx_db_row_t row;
unsigned char types[3];
zbx_dc_item_t items[3];
zbx_uint64_t itemids[3];
int errcodes[3];
size_t num = 0;
AGENT_RESULT value;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
result = zbx_db_select("select type,itemid from httptestitem where httptestid=" ZBX_FS_UI64, httptestid);