Source
xxxxxxxxxx
static void db_get_query_events(zbx_vector_ptr_t *event_queries, zbx_vector_ptr_t *event_data, int process_num)
/*
** 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.
**/
extern int CONFIG_FORKS[ZBX_PROCESS_TYPE_COUNT];
/* addition data for event maintenance calculations to pair with zbx_event_suppress_query_t */
typedef struct
{
zbx_uint64_t eventid;
zbx_vector_uint64_pair_t maintenances;
}
zbx_event_suppress_data_t;
/******************************************************************************
* *
* Purpose: log host maintenance changes *
* *
******************************************************************************/
static void log_host_maintenance_update(const zbx_host_maintenance_diff_t* diff)
{
char *msg = NULL;
size_t msg_alloc = 0, msg_offset = 0;
int maintenance_off = 0;
if (0 != (diff->flags & ZBX_FLAG_HOST_MAINTENANCE_UPDATE_MAINTENANCE_STATUS))
{
if (HOST_MAINTENANCE_STATUS_ON == diff->maintenance_status)
{
zbx_snprintf_alloc(&msg, &msg_alloc, &msg_offset, "putting host (" ZBX_FS_UI64 ") into",
diff->hostid);
}
else
{
maintenance_off = 1;
zbx_snprintf_alloc(&msg, &msg_alloc, &msg_offset, "taking host (" ZBX_FS_UI64 ") out of",
diff->hostid);
}
}
else
zbx_snprintf_alloc(&msg, &msg_alloc, &msg_offset, "changing host (" ZBX_FS_UI64 ")", diff->hostid);
zbx_strcpy_alloc(&msg, &msg_alloc, &msg_offset, " maintenance");
if (0 != (diff->flags & ZBX_FLAG_HOST_MAINTENANCE_UPDATE_MAINTENANCEID) && 0 != diff->maintenanceid)
zbx_snprintf_alloc(&msg, &msg_alloc, &msg_offset, "(" ZBX_FS_UI64 ")", diff->maintenanceid);
if (0 != (diff->flags & ZBX_FLAG_HOST_MAINTENANCE_UPDATE_MAINTENANCE_TYPE) && 0 == maintenance_off)
{
const char *description[] = {"with data collection", "without data collection"};
zbx_snprintf_alloc(&msg, &msg_alloc, &msg_offset, " %s", description[diff->maintenance_type]);
}
zabbix_log(LOG_LEVEL_DEBUG, "%s", msg);
zbx_free(msg);
}
/******************************************************************************
* *
* Purpose: update host maintenance properties in database *
* *