Source
const ZBX_FIELD field = {"application_prototypeid", NULL, "application_prototype", "application_prototypeid",
/*
** 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.
**/
/*
* 3.0 development database patches
*/
static int DBpatch_2050000(void)
{
const ZBX_FIELD field = {"agent", "Zabbix", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("httptest", &field);
}
static int DBpatch_2050001(void)
{
DB_RESULT result;
DB_ROW row;
char *oid = NULL;
size_t oid_alloc = 0;
int ret = FAIL, rc;
/* flags - ZBX_FLAG_DISCOVERY_RULE */
/* type - ITEM_TYPE_SNMPv1, ITEM_TYPE_SNMPv2c, ITEM_TYPE_SNMPv3 */
if (NULL == (result = zbx_db_select("select itemid,snmp_oid from items where flags=1 and type in (1,4,6)")))
return FAIL;
while (NULL != (row = zbx_db_fetch(result)))
{
char *param, *oid_esc;
size_t oid_offset = 0;
param = zbx_strdup(NULL, row[1]);
zbx_snprintf_alloc(&oid, &oid_alloc, &oid_offset, "discovery[{#SNMPVALUE},%s]", param);
if (FAIL == zbx_quote_key_param(¶m, 0))
{
zabbix_log(LOG_LEVEL_WARNING, "cannot convert SNMP discovery OID \"%s\":"
" OID contains invalid character(s)", row[1]);