@cryptotaxi247 / netdata-1 / commits / 4a935930a

minor - add host labels for ephemerality and nodes with unstable connections (#13784)

* add host labels for ephemerality and nodes with unstable connections

Timotej S committed Oct 11, 2022 at 12:27 UTC 4a935930abe0cbed5aa5f9b583e91fdaf4278223
3 files changed +14
database/rrdhost.c
+2
@@ -1303,6 +1303,8 @@ static void rrdhost_load_auto_labels(void) {
1303
1304 add_aclk_host_labels();
1305
1306 + health_add_host_labels();
1307 +
1308 rrdlabels_add(
1309 labels, "_is_parent", (rrdhost_hosts_available() > 1 || configured_as_parent()) ? "true" : "false", RRDLABEL_SRC_AUTO);
1310
health/health.c
+10
@@ -1307,3 +1307,13 @@ void *health_main(void *ptr) {
1307 netdata_thread_cleanup_pop(1);
1308 return NULL;
1309 }
1310 +
1311 +void health_add_host_labels(void) {
1312 + DICTIONARY *labels = localhost->rrdlabels;
1313 +
1314 + int is_ephemeral = appconfig_get_boolean(&netdata_config, CONFIG_SECTION_HEALTH, "is ephemeral", CONFIG_BOOLEAN_NO);
1315 + rrdlabels_add(labels, "_is_ephemeral", is_ephemeral ? "true" : "false", RRDLABEL_SRC_CONFIG);
1316 +
1317 + int has_unstable_connection = appconfig_get_boolean(&netdata_config, CONFIG_SECTION_HEALTH, "has unstable connection", CONFIG_BOOLEAN_NO);
1318 + rrdlabels_add(labels, "_has_unstable_connection", has_unstable_connection ? "true" : "false", RRDLABEL_SRC_CONFIG);
1319 +}
health/health.h
+2
@@ -90,4 +90,6 @@ void health_label_log_save(RRDHOST *host);
90 char *health_edit_command_from_source(const char *source);
91 void sql_refresh_hashes(void);
92
93 +void health_add_host_labels(void);
94 +
95 #endif //NETDATA_HEALTH_H