| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_HEALTH_ALERT_ENTRY_H |
| 4 | #define NETDATA_HEALTH_ALERT_ENTRY_H |
| 5 | |
| 6 | #include "libnetdata/libnetdata.h" |
| 7 | #include "rrdcalc.h" |
| 8 | |
| 9 | struct alarm_entry { |
| 10 | uint32_t unique_id; |
| 11 | uint32_t alarm_id; |
| 12 | uint32_t alarm_event_id; |
| 13 | usec_t global_id; |
| 14 | nd_uuid_t config_hash_id; |
| 15 | nd_uuid_t transition_id; |
| 16 | |
| 17 | time_t when; |
| 18 | time_t duration; |
| 19 | time_t non_clear_duration; |
| 20 | |
| 21 | STRING *name; |
| 22 | STRING *chart; |
| 23 | STRING *chart_context; |
| 24 | STRING *chart_name; |
| 25 | |
| 26 | STRING *classification; |
| 27 | STRING *component; |
| 28 | STRING *type; |
| 29 | |
| 30 | STRING *exec; |
| 31 | STRING *recipient; |
| 32 | time_t exec_run_timestamp; |
| 33 | int exec_code; |
| 34 | |
| 35 | STRING *source; |
| 36 | STRING *units; |
| 37 | STRING *summary; |
| 38 | STRING *info; |
| 39 | |
| 40 | NETDATA_DOUBLE old_value; |
| 41 | NETDATA_DOUBLE new_value; |
| 42 | |
| 43 | STRING *old_value_string; |
| 44 | STRING *new_value_string; |
| 45 | |
| 46 | RRDCALC_STATUS old_status; |
| 47 | RRDCALC_STATUS new_status; |
| 48 | |
| 49 | uint32_t flags; |
| 50 | int32_t pending_save_count; |
| 51 | |
| 52 | int delay; |
| 53 | time_t delay_up_to_timestamp; |
| 54 | |
| 55 | uint32_t updated_by_id; |
| 56 | uint32_t updates_id; |
| 57 | |
| 58 | time_t last_repeat; |
| 59 | |
| 60 | POPEN_INSTANCE *popen_instance; |
| 61 | |
| 62 | struct alarm_entry *next, *prev; |
| 63 | struct alarm_entry *next_in_progress; |
| 64 | struct alarm_entry *prev_in_progress; |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | #define ae_name(ae) string2str((ae)->name) |
| 69 | #define ae_chart_id(ae) string2str((ae)->chart) |
| 70 | #define ae_chart_name(ae) string2str((ae)->chart_name) |
| 71 | #define ae_chart_context(ae) string2str((ae)->chart_context) |
| 72 | #define ae_classification(ae) string2str((ae)->classification) |
| 73 | #define ae_exec(ae) string2str((ae)->exec) |
| 74 | #define ae_recipient(ae) string2str((ae)->recipient) |
| 75 | #define ae_source(ae) string2str((ae)->source) |
| 76 | #define ae_units(ae) string2str((ae)->units) |
| 77 | #define ae_summary(ae) string2str((ae)->summary) |
| 78 | #define ae_info(ae) string2str((ae)->info) |
| 79 | #define ae_old_value_string(ae) string2str((ae)->old_value_string) |
| 80 | #define ae_new_value_string(ae) string2str((ae)->new_value_string) |
| 81 | |
| 82 | // Function to clean up old alarm entries based on retention settings |
| 83 | void health_alarm_log_cleanup(RRDHOST *host); |
| 84 | |
| 85 | #endif //NETDATA_HEALTH_ALERT_ENTRY_H |