Source
zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type, items[i].flags, NULL,
/*
** 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 trap_fd = -1;
static off_t trap_lastsize;
static ino_t trap_ino = 0;
static char *buffer = NULL;
static int offset = 0;
static int force = 0;
static void DBget_lastsize(void)
{
zbx_db_result_t result;
zbx_db_row_t row;
zbx_db_begin();
result = zbx_db_select("select snmp_lastsize from globalvars");
if (NULL == (row = zbx_db_fetch(result)))
{
zbx_db_execute("insert into globalvars (globalvarid,snmp_lastsize) values (1,0)");
trap_lastsize = 0;
}
else
ZBX_STR2UINT64(trap_lastsize, row[0]);
zbx_db_free_result(result);
zbx_db_commit();
}
static void DBupdate_lastsize(void)
{
zbx_db_begin();
zbx_db_execute("update globalvars set snmp_lastsize=%lld", (long long int)trap_lastsize);
zbx_db_commit();
}
/******************************************************************************
* *
* Purpose: add trap to all matching items for the specified interface *
* *
* Return value: SUCCEED - a matching item was found *
* FAIL - no matching item was found (including fallback items) *
* *
******************************************************************************/
static int process_trap_for_interface(zbx_uint64_t interfaceid, char *trap, zbx_timespec_t *ts)
{
zbx_dc_item_t *items = NULL;
const char *regex;
char error[ZBX_ITEM_ERROR_LEN_MAX];
size_t num, i;
int ret = FAIL, fb = -1, *lastclocks = NULL, *errcodes = NULL, value_type, regexp_ret;
zbx_uint64_t *itemids = NULL;
AGENT_RESULT *results = NULL;
AGENT_REQUEST request;
zbx_vector_expression_t regexps;
zbx_dc_um_handle_t *um_handle;
zbx_vector_expression_create(®exps);