summaryrefslogtreecommitdiffstats
path: root/health/health.h
diff options
context:
space:
mode:
Diffstat (limited to 'health/health.h')
-rw-r--r--health/health.h116
1 files changed, 62 insertions, 54 deletions
diff --git a/health/health.h b/health/health.h
index 3e77c12a7..15d8326ee 100644
--- a/health/health.h
+++ b/health/health.h
@@ -14,6 +14,7 @@ extern unsigned int default_health_enabled;
#define HEALTH_ENTRY_FLAG_SILENCED 0x00000010
#define HEALTH_ENTRY_RUN_ONCE 0x00000020
#define HEALTH_ENTRY_FLAG_EXEC_IN_PROGRESS 0x00000040
+#define HEALTH_ENTRY_FLAG_IS_REPEATING 0x00000080
#define HEALTH_ENTRY_FLAG_SAVED 0x10000000
#define HEALTH_ENTRY_FLAG_ACLK_QUEUED 0x20000000
@@ -31,65 +32,72 @@ extern unsigned int default_health_enabled;
extern char *silencers_filename;
-extern void health_init(void);
+void health_init(void);
-extern void health_reload(void);
+void health_reload(void);
-extern int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, NETDATA_DOUBLE *result);
-extern void health_aggregate_alarms(RRDHOST *host, BUFFER *wb, BUFFER* context, RRDCALC_STATUS status);
-extern void health_alarms2json(RRDHOST *host, BUFFER *wb, int all);
-extern void health_alarms_values2json(RRDHOST *host, BUFFER *wb, int all);
-extern void health_alarm_log2json(RRDHOST *host, BUFFER *wb, uint32_t after, char *chart);
+void health_aggregate_alarms(RRDHOST *host, BUFFER *wb, BUFFER* context, RRDCALC_STATUS status);
+void health_alarms2json(RRDHOST *host, BUFFER *wb, int all);
+void health_alarms_values2json(RRDHOST *host, BUFFER *wb, int all);
+void health_alarm_log2json(RRDHOST *host, BUFFER *wb, uint32_t after, char *chart);
void health_api_v1_chart_variables2json(RRDSET *st, BUFFER *buf);
void health_api_v1_chart_custom_variables2json(RRDSET *st, BUFFER *buf);
-extern int health_alarm_log_open(RRDHOST *host);
-extern void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae);
-extern void health_alarm_log_load(RRDHOST *host);
-
-extern ALARM_ENTRY* health_create_alarm_entry(
- RRDHOST *host,
- uint32_t alarm_id,
- uint32_t alarm_event_id,
- uuid_t config_hash_id,
- time_t when,
- const char *name,
- const char *chart,
- const char *chart_context,
- const char *family,
- const char *classification,
- const char *component,
- const char *type,
- const char *exec,
- const char *recipient,
- time_t duration,
- NETDATA_DOUBLE old_value,
- NETDATA_DOUBLE new_value,
- RRDCALC_STATUS old_status,
- RRDCALC_STATUS new_status,
- const char *source,
- const char *units,
- const char *info,
- int delay,
- uint32_t flags);
-
-extern void health_alarm_log(RRDHOST *host, ALARM_ENTRY *ae);
-
-extern void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path, const char *subpath);
-extern char *health_user_config_dir(void);
-extern char *health_stock_config_dir(void);
-extern void health_alarm_log_free(RRDHOST *host);
-
-extern void health_alarm_log_free_one_nochecks_nounlink(ALARM_ENTRY *ae);
-
-extern void *health_cmdapi_thread(void *ptr);
-
-extern void health_label_log_save(RRDHOST *host);
-
-extern char *health_edit_command_from_source(const char *source);
-extern void sql_refresh_hashes(void);
-
-extern SIMPLE_PATTERN *health_pattern_from_foreach(char *s);
+int health_alarm_log_open(RRDHOST *host);
+void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae);
+void health_alarm_log_load(RRDHOST *host);
+
+void health_thread_spawn(RRDHOST *host);
+void health_thread_stop(RRDHOST *host);
+
+ALARM_ENTRY* health_create_alarm_entry(
+ RRDHOST *host,
+ uint32_t alarm_id,
+ uint32_t alarm_event_id,
+ const uuid_t config_hash_id,
+ time_t when,
+ STRING *name,
+ STRING *chart,
+ STRING *chart_context,
+ STRING *family,
+ STRING *classification,
+ STRING *component,
+ STRING *type,
+ STRING *exec,
+ STRING *recipient,
+ time_t duration,
+ NETDATA_DOUBLE old_value,
+ NETDATA_DOUBLE new_value,
+ RRDCALC_STATUS old_status,
+ RRDCALC_STATUS new_status,
+ STRING *source,
+ STRING *units,
+ STRING *info,
+ int delay,
+ uint32_t flags);
+
+void health_alarm_log_add_entry(RRDHOST *host, ALARM_ENTRY *ae);
+
+struct health_state {
+ RRDHOST *host;
+ netdata_thread_t thread;
+};
+
+void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path, const char *subpath);
+char *health_user_config_dir(void);
+char *health_stock_config_dir(void);
+void health_alarm_log_free(RRDHOST *host);
+
+void health_alarm_log_free_one_nochecks_nounlink(ALARM_ENTRY *ae);
+
+void *health_cmdapi_thread(void *ptr);
+
+void health_label_log_save(RRDHOST *host);
+
+char *health_edit_command_from_source(const char *source);
+void sql_refresh_hashes(void);
+
+void health_add_host_labels(void);
#endif //NETDATA_HEALTH_H