summaryrefslogtreecommitdiffstats
path: root/src/health/health.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:33:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:34:10 +0000
commit83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch)
tree2e69833b43f791ed253a7a20318b767ebe56cdb8 /src/health/health.c
parentReleasing debian version 1.47.5-1. (diff)
downloadnetdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz
netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/health/health.c')
-rw-r--r--src/health/health.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/health/health.c b/src/health/health.c
index 7039a193c..78559d7f4 100644
--- a/src/health/health.c
+++ b/src/health/health.c
@@ -14,7 +14,7 @@ struct health_plugin_globals health_globals = {
.use_summary_for_notifications = true,
.health_log_entries_max = HEALTH_LOG_ENTRIES_DEFAULT,
- .health_log_history = HEALTH_LOG_HISTORY_DEFAULT,
+ .health_log_retention_s = HEALTH_LOG_RETENTION_DEFAULT,
.default_warn_repeat_every = 0,
.default_crit_repeat_every = 0,
@@ -55,17 +55,17 @@ static void health_load_config_defaults(void) {
health_globals.config.use_summary_for_notifications);
health_globals.config.default_warn_repeat_every =
- config_get_duration(CONFIG_SECTION_HEALTH, "default repeat warning", "never");
+ config_get_duration_seconds(CONFIG_SECTION_HEALTH, "default repeat warning", 0);
health_globals.config.default_crit_repeat_every =
- config_get_duration(CONFIG_SECTION_HEALTH, "default repeat critical", "never");
+ config_get_duration_seconds(CONFIG_SECTION_HEALTH, "default repeat critical", 0);
health_globals.config.health_log_entries_max =
config_get_number(CONFIG_SECTION_HEALTH, "in memory max health log entries",
health_globals.config.health_log_entries_max);
- health_globals.config.health_log_history =
- config_get_number(CONFIG_SECTION_HEALTH, "health log history", HEALTH_LOG_DEFAULT_HISTORY);
+ health_globals.config.health_log_retention_s =
+ config_get_duration_seconds(CONFIG_SECTION_HEALTH, "health log retention", HEALTH_LOG_RETENTION_DEFAULT);
snprintfz(filename, FILENAME_MAX, "%s/alarm-notify.sh", netdata_configured_primary_plugins_dir);
health_globals.config.default_exec =
@@ -76,14 +76,13 @@ static void health_load_config_defaults(void) {
NULL, SIMPLE_PATTERN_EXACT, true);
health_globals.config.run_at_least_every_seconds =
- (int)config_get_number(CONFIG_SECTION_HEALTH,
- "run at least every seconds",
- health_globals.config.run_at_least_every_seconds);
+ (int)config_get_duration_seconds(CONFIG_SECTION_HEALTH, "run at least every",
+ health_globals.config.run_at_least_every_seconds);
health_globals.config.postpone_alarms_during_hibernation_for_seconds =
- config_get_number(CONFIG_SECTION_HEALTH,
- "postpone alarms during hibernation for seconds",
- health_globals.config.postpone_alarms_during_hibernation_for_seconds);
+ config_get_duration_seconds(CONFIG_SECTION_HEALTH,
+ "postpone alarms during hibernation for",
+ health_globals.config.postpone_alarms_during_hibernation_for_seconds);
health_globals.config.default_recipient =
string_strdupz("root");
@@ -115,27 +114,27 @@ static void health_load_config_defaults(void) {
(long)health_globals.config.health_log_entries_max);
}
- if (health_globals.config.health_log_history < HEALTH_LOG_MINIMUM_HISTORY) {
+ if (health_globals.config.health_log_retention_s < HEALTH_LOG_MINIMUM_HISTORY) {
nd_log(NDLS_DAEMON, NDLP_WARNING,
- "Health configuration has invalid health log history %u. Using minimum %d",
- health_globals.config.health_log_history, HEALTH_LOG_MINIMUM_HISTORY);
+ "Health configuration has invalid health log retention %u. Using minimum %d",
+ health_globals.config.health_log_retention_s, HEALTH_LOG_MINIMUM_HISTORY);
- health_globals.config.health_log_history = HEALTH_LOG_MINIMUM_HISTORY;
- config_set_number(CONFIG_SECTION_HEALTH, "health log history", health_globals.config.health_log_history);
+ health_globals.config.health_log_retention_s = HEALTH_LOG_MINIMUM_HISTORY;
+ config_set_duration_seconds(CONFIG_SECTION_HEALTH, "health log retention", health_globals.config.health_log_retention_s);
}
nd_log(NDLS_DAEMON, NDLP_DEBUG,
"Health log history is set to %u seconds (%u days)",
- health_globals.config.health_log_history, health_globals.config.health_log_history / 86400);
+ health_globals.config.health_log_retention_s, health_globals.config.health_log_retention_s / 86400);
}
-inline char *health_user_config_dir(void) {
+inline const char *health_user_config_dir(void) {
char buffer[FILENAME_MAX + 1];
snprintfz(buffer, FILENAME_MAX, "%s/health.d", netdata_configured_user_config_dir);
return config_get(CONFIG_SECTION_DIRECTORIES, "health config", buffer);
}
-inline char *health_stock_config_dir(void) {
+inline const char *health_stock_config_dir(void) {
char buffer[FILENAME_MAX + 1];
snprintfz(buffer, FILENAME_MAX, "%s/health.d", netdata_configured_stock_config_dir);
return config_get(CONFIG_SECTION_DIRECTORIES, "stock health config", buffer);