// SPDX-License-Identifier: GPL-3.0-or-later#include"health.h"#define WORKER_HEALTH_JOB_RRD_LOCK 0#define WORKER_HEALTH_JOB_HOST_LOCK 1#define WORKER_HEALTH_JOB_DB_QUERY 2#define WORKER_HEALTH_JOB_CALC_EVAL 3#define WORKER_HEALTH_JOB_WARNING_EVAL 4#define WORKER_HEALTH_JOB_CRITICAL_EVAL 5#define WORKER_HEALTH_JOB_ALARM_LOG_ENTRY 6#define WORKER_HEALTH_JOB_ALARM_LOG_PROCESS 7#define WORKER_HEALTH_JOB_DELAYED_INIT_RRDSET 8#define WORKER_HEALTH_JOB_DELAYED_INIT_RRDDIM 9#if WORKER_UTILIZATION_MAX_JOB_TYPES < 10#error WORKER_UTILIZATION_MAX_JOB_TYPES has to be at least 10#endifunsignedintdefault_health_enabled=1;char*silencers_filename;// the queue of executed alarm notifications that haven't been waited for yetstaticstruct{ALARM_ENTRY*head;// oldestALARM_ENTRY*tail;// latest}alarm_notifications_in_progress={NULL,NULL};typedefstructactive_alerts{char*name;time_tlast_status_change;RRDCALC_STATUSstatus;}active_alerts_t;staticinlinevoidenqueue_alarm_notify_in_progress(ALARM_ENTRY*ae){ae->prev_in_progress=NULL;ae->next_in_progress=NULL;if(NULL!=alarm_notifications_in_progress.tail){ae->prev_in_progress=alarm_notifications_in_progress.tail;alarm_notifications_in_progress.tail->next_in_progress=ae;}if(NULL==alarm_notifications_in_progress.head){alarm_notifications_in_progress.head=ae;}alarm_notifications_in_progress.tail=ae;}staticinlinevoidunlink_alarm_notify_in_progress(ALARM_ENTRY*ae){structalarm_entry*prev=ae->prev_in_progress;structalarm_entry*next=ae->next_in_progress;if(NULL!=prev){prev->next_in_progress=next;}if(NULL!=next){next->prev_in_progress=prev;}if(ae==alarm_notifications_in_p