Source
static void discovery_update_service_status(zbx_db_dhost *dhost, const DB_DSERVICE *dservice, int service_status,
/*
** 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.
**/
typedef struct
{
zbx_uint64_t dserviceid;
int status;
int lastup;
int lastdown;
char *value;
}
DB_DSERVICE;
static DB_RESULT discovery_get_dhost_by_value(zbx_uint64_t dcheckid, const char *value)
{
DB_RESULT result;
char *value_esc;
value_esc = zbx_db_dyn_escape_field("dservices", "value", value);
result = zbx_db_select(
"select dh.dhostid,dh.status,dh.lastup,dh.lastdown"
" from dhosts dh,dservices ds"
" where ds.dhostid=dh.dhostid"
" and ds.dcheckid=" ZBX_FS_UI64
" and ds.value" ZBX_SQL_STRCMP
" order by dh.dhostid",
dcheckid, ZBX_SQL_STRVAL_EQ(value_esc));
zbx_free(value_esc);
return result;
}
static DB_RESULT discovery_get_dhost_by_ip_port(zbx_uint64_t druleid, const char *ip, int port)
{
DB_RESULT result;
char *ip_esc;
ip_esc = zbx_db_dyn_escape_field("dservices", "ip", ip);