| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_HEALTH_SILENCERS_H |
| 4 | #define NETDATA_HEALTH_SILENCERS_H |
| 5 | |
| 6 | #include "health.h" |
| 7 | |
| 8 | typedef struct silencer { |
| 9 | char *alarms; |
| 10 | SIMPLE_PATTERN *alarms_pattern; |
| 11 | |
| 12 | char *hosts; |
| 13 | SIMPLE_PATTERN *hosts_pattern; |
| 14 | |
| 15 | char *contexts; |
| 16 | SIMPLE_PATTERN *contexts_pattern; |
| 17 | |
| 18 | char *charts; |
| 19 | SIMPLE_PATTERN *charts_pattern; |
| 20 | |
| 21 | struct silencer *next; |
| 22 | } SILENCER; |
| 23 | |
| 24 | typedef enum silence_type { |
| 25 | STYPE_NONE, |
| 26 | STYPE_DISABLE_ALARMS, |
| 27 | STYPE_SILENCE_NOTIFICATIONS |
| 28 | } SILENCE_TYPE; |
| 29 | |
| 30 | typedef struct silencers { |
| 31 | int all_alarms; |
| 32 | SILENCE_TYPE stype; |
| 33 | SILENCER *silencers; |
| 34 | } SILENCERS; |
| 35 | |
| 36 | extern SILENCERS *silencers; |
| 37 | |
| 38 | SILENCER *create_silencer(void); |
| 39 | int health_silencers_json_read_callback(JSON_ENTRY *e); |
| 40 | void health_silencers_add(SILENCER *silencer); |
| 41 | SILENCER * health_silencers_addparam(SILENCER *silencer, char *key, char *value); |
| 42 | int health_initialize_global_silencers(); |
| 43 | |
| 44 | void free_silencers(SILENCER *t); |
| 45 | |
| 46 | struct web_client; |
| 47 | int web_client_api_request_v1_mgmt_health(RRDHOST *host, struct web_client *w, char *url); |
| 48 | |
| 49 | const char *health_silencers_filename(void); |
| 50 | void health_set_silencers_filename(void); |
| 51 | void health_silencers_init(void); |
| 52 | SILENCE_TYPE health_silencers_check_silenced(RRDCALC *rc, const char *host); |
| 53 | int health_silencers_update_disabled_silenced(RRDHOST *host, RRDCALC *rc); |
| 54 | |
| 55 | #endif //NETDATA_HEALTH_SILENCERS_H |