mirror of
https://github.com/netdata/netdata.git
synced 2025-04-07 23:05:41 +00:00

* alarm_clear: Mapping In this PR I mapped all the necessary steps to discover the solution for the ISSUE 6581 * alarm_clear: Documentation and fixes This commit fixes the problem that were present in Netdata and it also updates the documentation of the functions and Netdata. * alarm_clear: shell script The original implementation did not have a shell script, here I begin to fix this * alarm_clear: shell script It is necessay to verify why make is not producing the same binary than cmake and finish the changes in the script * alarm_clear: adjust in health.c I rewrote the health.c to be more readable, but I discovered the problem I had in the last few hours were due kernel update * alarm_clear: script changes In this commit I am bringing the final version of the script that test the alarm repetition * alarm_clear: script fix and remove comments IN this commit I am fixing the shellcheck errors and removing some debug messages that were present in the code while I was developing * alarm_clear: Format The health.c had wrong tabulation, this PR brings back the pattern of space as tab for this file * alarm_clear: Script The script was using killlall that is not more present in all Linux distribution this commit removes this and bring the new way to stop Netdata * alarm_clear: return to previous tabulation I am bringing back the old tabulation here and I will create a new PR exclusively for this * alarm_clear: Remove comments I am removing comments from this PR to keep the focus in the major problem * alarm_clear: Remove comments 2 I forgot one comment * alarm_clear: New variable I am appending a new variable in the check before the rebase, because the health.c changed in other file has a direct relationship with what I did here until now * alarm_clear: Fix clear repetition With this last commit, I am bringing a new way to raise the clear alarm, but it is not repeating more with this fix, it displayed one time when it is cleaned and it will display the message again, if and only if, the alarm was raised.
109 lines
3.5 KiB
C
109 lines
3.5 KiB
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#ifndef NETDATA_HEALTH_H
|
|
#define NETDATA_HEALTH_H 1
|
|
|
|
#include "../daemon/common.h"
|
|
|
|
#define NETDATA_PLUGIN_HOOK_HEALTH \
|
|
{ \
|
|
.name = "HEALTH", \
|
|
.config_section = NULL, \
|
|
.config_name = NULL, \
|
|
.enabled = 1, \
|
|
.thread = NULL, \
|
|
.init_routine = NULL, \
|
|
.start_routine = health_main \
|
|
},
|
|
|
|
extern unsigned int default_health_enabled;
|
|
|
|
#define HEALTH_ENTRY_FLAG_PROCESSED 0x00000001
|
|
#define HEALTH_ENTRY_FLAG_UPDATED 0x00000002
|
|
#define HEALTH_ENTRY_FLAG_EXEC_RUN 0x00000004
|
|
#define HEALTH_ENTRY_FLAG_EXEC_FAILED 0x00000008
|
|
#define HEALTH_ENTRY_FLAG_SILENCED 0x00000010
|
|
#define HEALTH_ENTRY_RUN_ONCE 0x00000020
|
|
|
|
#define HEALTH_ENTRY_FLAG_SAVED 0x10000000
|
|
#define HEALTH_ENTRY_FLAG_NO_CLEAR_NOTIFICATION 0x80000000
|
|
|
|
#ifndef HEALTH_LISTEN_PORT
|
|
#define HEALTH_LISTEN_PORT 19998
|
|
#endif
|
|
|
|
#ifndef HEALTH_LISTEN_BACKLOG
|
|
#define HEALTH_LISTEN_BACKLOG 4096
|
|
#endif
|
|
|
|
#define HEALTH_ON_KEY "on"
|
|
#define HEALTH_EVERY_KEY "every"
|
|
#define HEALTH_GREEN_KEY "green"
|
|
#define HEALTH_RED_KEY "red"
|
|
#define HEALTH_WARN_KEY "warn"
|
|
#define HEALTH_CRIT_KEY "crit"
|
|
#define HEALTH_EXEC_KEY "exec"
|
|
#define HEALTH_RECIPIENT_KEY "to"
|
|
#define HEALTH_UNITS_KEY "units"
|
|
#define HEALTH_INFO_KEY "info"
|
|
#define HEALTH_DELAY_KEY "delay"
|
|
#define HEALTH_OPTIONS_KEY "options"
|
|
|
|
#define HEALTH_SILENCERS_MAX_FILE_LEN 10000
|
|
|
|
char *silencers_filename;
|
|
|
|
extern void health_init(void);
|
|
extern void *health_main(void *ptr);
|
|
|
|
extern void health_reload(void);
|
|
|
|
extern int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, calculated_number *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_alarm_log2json(RRDHOST *host, BUFFER *wb, uint32_t after);
|
|
|
|
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_close(RRDHOST *host);
|
|
extern void health_log_rotate(RRDHOST *host);
|
|
extern void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae);
|
|
extern ssize_t health_alarm_log_read(RRDHOST *host, FILE *fp, const char *filename);
|
|
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,
|
|
time_t when,
|
|
const char *name,
|
|
const char *chart,
|
|
const char *family,
|
|
const char *exec,
|
|
const char *recipient,
|
|
time_t duration,
|
|
calculated_number old_value,
|
|
calculated_number 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_reload_host(RRDHOST *host);
|
|
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);
|
|
|
|
#endif //NETDATA_HEALTH_H
|