master
h 42 lines 1.72 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_HEALTH_ALERT_LOG_H
4 #define NETDATA_HEALTH_ALERT_LOG_H
5
6 #include "libnetdata/libnetdata.h"
7
8 typedef struct alarm_log {
9 uint32_t next_log_id;
10 uint32_t next_alarm_id;
11 unsigned int max;
12 uint32_t health_log_retention_s; // the health log retention in seconds to be kept in db
13 struct alarm_entry *alarms;
14 RW_SPINLOCK spinlock;
15 } ALARM_LOG;
16
17 struct health_alert_status_counts {
18 uint32_t clear;
19 uint32_t warning;
20 uint32_t critical;
21 uint32_t undefined;
22 uint32_t uninitialized;
23 };
24
25 typedef struct health {
26 // Recomputed on each host health evaluation and read by alerts APIs as a host-level prefilter.
27 struct {
28 uint64_t generation; // seqlock-style generation for consistent readers
29 struct health_alert_status_counts counts;
30 uint8_t valid; // 1 when snapshot is fully published
31 } alert_status_snapshot;
32
33 time_t delay_up_to; // a timestamp to delay alarms processing up to
34 STRING *default_exec; // the full path of the alarms notifications program
35 STRING *default_recipient; // the default recipient for all alarms
36 bool enabled; // 1 when this host has health enabled
37 bool use_summary_for_notifications; // whether to use the summary field as a subject for notifications
38 int32_t pending_transitions; // pending alert transitions to store
39 uint64_t evloop_iteration; // the last health iteration that evaluated this host
40 } HEALTH;
41
42 #endif //NETDATA_HEALTH_ALERT_LOG_H