Source
zabbix_log(LOG_LEVEL_INFORMATION, "%s #%d started [%s #%d]", get_program_type_string(info->program_type),
/*
** 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_VMWARE_FREQUENCY;
extern int CONFIG_VMWARE_PERF_FREQUENCY;
extern zbx_vmware_t *vmware;
/******************************************************************************
* *
* Purpose: return string value of vmware job types *
* *
* Parameters: job - [IN] the vmware job *
* *
* Return value: job type string *
* *
******************************************************************************/
static const char *vmware_job_type_string(zbx_vmware_job_t *job)
{
switch (job->type)
{
case ZBX_VMWARE_UPDATE_CONF:
return "update_conf";
case ZBX_VMWARE_UPDATE_PERFCOUNTERS:
return "update_perf_counters";
case ZBX_VMWARE_UPDATE_REST_TAGS:
return "update_tags";
default:
return "unknown_job";
}
}
/******************************************************************************
* *
* Purpose: pick the next job from the queue and service ttl check *
* *
* Parameters: vmw - [IN] the vmware object *
* time_now - [IN] the current time *
* *
* Return value: job for object or NULL *
* *
******************************************************************************/
static zbx_vmware_job_t *vmware_job_get(zbx_vmware_t *vmw, time_t time_now)
{
zbx_binary_heap_elem_t *elem;
zbx_vmware_job_t *job = NULL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() queue:%d", __func__, vmw->jobs_queue.elems_num);
zbx_vmware_lock();
if (SUCCEED == zbx_binary_heap_empty(&vmw->jobs_queue))
goto unlock;
elem = zbx_binary_heap_find_min(&vmw->jobs_queue);
job = (zbx_vmware_job_t *)elem->data;
if (time_now < job->nextcheck)
{
job = NULL;
goto unlock;
}
zbx_binary_heap_remove_min(&vmw->jobs_queue);