health.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_HEALTH_LIB
  3. # define NETDATA_HEALTH_LIB 1
  4. # include "../libnetdata.h"
  5. #define HEALTH_ALARM_KEY "alarm"
  6. #define HEALTH_TEMPLATE_KEY "template"
  7. #define HEALTH_CONTEXT_KEY "context"
  8. #define HEALTH_CHART_KEY "chart"
  9. #define HEALTH_HOST_KEY "hosts"
  10. #define HEALTH_OS_KEY "os"
  11. #define HEALTH_LOOKUP_KEY "lookup"
  12. #define HEALTH_CALC_KEY "calc"
  13. typedef struct silencer {
  14. char *alarms;
  15. SIMPLE_PATTERN *alarms_pattern;
  16. char *hosts;
  17. SIMPLE_PATTERN *hosts_pattern;
  18. char *contexts;
  19. SIMPLE_PATTERN *contexts_pattern;
  20. char *charts;
  21. SIMPLE_PATTERN *charts_pattern;
  22. struct silencer *next;
  23. } SILENCER;
  24. typedef enum silence_type {
  25. STYPE_NONE,
  26. STYPE_DISABLE_ALARMS,
  27. STYPE_SILENCE_NOTIFICATIONS
  28. } SILENCE_TYPE;
  29. typedef struct silencers {
  30. int all_alarms;
  31. SILENCE_TYPE stype;
  32. SILENCER *silencers;
  33. } SILENCERS;
  34. extern SILENCERS *silencers;
  35. SILENCER *create_silencer(void);
  36. int health_silencers_json_read_callback(JSON_ENTRY *e);
  37. void health_silencers_add(SILENCER *silencer);
  38. SILENCER * health_silencers_addparam(SILENCER *silencer, char *key, char *value);
  39. int health_initialize_global_silencers();
  40. #endif