Source
zbx_setproctitle("%s #%d [connecting to the database]", get_process_type_string(process_type), process_num);
/*
** Zabbix
** Copyright (C) 2001-2025 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_HTTPPOLLER_FORKS;
extern ZBX_THREAD_LOCAL unsigned char process_type;
extern unsigned char program_type;
extern ZBX_THREAD_LOCAL int server_num, process_num;
/******************************************************************************
* *
* Purpose: calculate when we have to process earliest httptest *
* *
* Return value: timestamp of earliest check or -1 if not found *
* *
******************************************************************************/
static int get_minnextcheck(void)
{
DB_RESULT result;
DB_ROW row;
int res;
result = DBselect(
"select min(t.nextcheck)"
" from httptest t,hosts h"
" where t.hostid=h.hostid"
" and " ZBX_SQL_MOD(t.httptestid,%d) "=%d"
" and t.status=%d"
" and h.proxy_hostid is null"
" and h.status=%d"
" and (h.maintenance_status=%d or h.maintenance_type=%d)",
CONFIG_HTTPPOLLER_FORKS, process_num - 1,
HTTPTEST_STATUS_MONITORED,
HOST_STATUS_MONITORED,
HOST_MAINTENANCE_STATUS_OFF, MAINTENANCE_TYPE_NORMAL);
if (NULL == (row = DBfetch(result)) || SUCCEED == DBis_null(row[0]))
{
zabbix_log(LOG_LEVEL_DEBUG, "No httptests to process in get_minnextcheck.");