| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_SQLITE_HEALTH_H |
| 4 | #define NETDATA_SQLITE_HEALTH_H |
| 5 | |
| 6 | #include "database/rrd.h" |
| 7 | #include "database/sqlite/vendored/sqlite3.h" |
| 8 | |
| 9 | #define ALERT_TRANSITION_DELAY_LONG (600) |
| 10 | #define ALERT_TRANSITION_DELAY_SHORT (10) |
| 11 | #define ALERT_TRANSITION_DELAY_NONE (0) |
| 12 | |
| 13 | struct sql_alert_transition_data; |
| 14 | struct sql_alert_config_data; |
| 15 | struct rrd_alert_prototype; |
| 16 | void sql_health_alarm_log_load(RRDHOST *host); |
| 17 | void sql_health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae); |
| 18 | void sql_health_alarm_log_cleanup(RRDHOST *host); |
| 19 | void sql_alert_store_config(struct rrd_alert_prototype *ap); |
| 20 | int sql_health_get_last_executed_event(RRDHOST *host, ALARM_ENTRY *ae, RRDCALC_STATUS *last_executed_status); |
| 21 | void sql_health_alarm_log2json(RRDHOST *host, BUFFER *wb, time_t after, const char *chart); |
| 22 | int health_migrate_old_health_log_table(char *table); |
| 23 | uint32_t sql_get_alarm_id(RRDHOST *host, STRING *chart, STRING *name, uint32_t *next_event_id); |
| 24 | void sql_alert_transitions( |
| 25 | DICTIONARY *nodes, |
| 26 | time_t after, |
| 27 | time_t before, |
| 28 | const char *context, |
| 29 | const char *alert_name, |
| 30 | const char *transition, |
| 31 | void (*cb)(struct sql_alert_transition_data *, void *), |
| 32 | void *data, |
| 33 | bool debug); |
| 34 | |
| 35 | int sql_get_alert_configuration( |
| 36 | DICTIONARY *configs, |
| 37 | void (*cb)(struct sql_alert_config_data *, void *), |
| 38 | void *data, |
| 39 | bool debug __maybe_unused); |
| 40 | |
| 41 | bool sql_find_alert_transition(const char *transition, void (*cb)(const char *machine_guid, const char *context, time_t alert_id, void *data), void *data); |
| 42 | void sql_alert_cleanup(bool cli); |
| 43 | #endif //NETDATA_SQLITE_HEALTH_H |