Source
xxxxxxxxxx
static void am_db_update_event_tags(zbx_uint64_t eventid, const char *params, zbx_vector_events_tags_t *events_tags)
/*
** 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_hashset_t mediatypes;
zbx_ipc_socket_t am;
}
zbx_am_db_t;
/******************************************************************************
* *
* Purpose: creates new alert object *
* *
* Parameters: ... - [IN] alert data *
* *
* Return value: alert object. *
* *
******************************************************************************/
static zbx_am_db_alert_t *am_db_create_alert(zbx_uint64_t alertid, zbx_uint64_t mediatypeid, int source,
int object, zbx_uint64_t objectid, zbx_uint64_t eventid, zbx_uint64_t p_eventid, const char *sendto,
const char *subject, const char *message, const char *params, int status, int retries)
{
zbx_am_db_alert_t *alert;
alert = (zbx_am_db_alert_t *)zbx_malloc(NULL, sizeof(zbx_am_db_alert_t));
alert->alertid = alertid;
alert->mediatypeid = mediatypeid;
alert->source = source;
alert->object = object;
alert->objectid = objectid;
alert->eventid = eventid;
alert->p_eventid = p_eventid;
alert->sendto = zbx_strdup(NULL, sendto);
alert->subject = zbx_strdup(NULL, subject);
alert->message = zbx_strdup(NULL, message);
alert->params = zbx_strdup(NULL, params);
alert->status = status;
alert->retries = retries;
return alert;
}
static int am_db_init(zbx_am_db_t *amdb, char **error)
{
zbx_hashset_create(&amdb->mediatypes, 5, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
if (SUCCEED != zbx_ipc_socket_open(&amdb->am, ZBX_IPC_SERVICE_ALERTER, SEC_PER_MIN, error))
return FAIL;
return SUCCEED;
}
static void am_db_clear(zbx_am_db_t *amdb)