diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-01-26 18:05:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-01-26 18:05:42 +0000 |
commit | 112b5b91647c3dea45cc1c9bc364df526c8012f1 (patch) | |
tree | 450af925135ec664c4310a1eb28b69481094ee2a /aclk/aclk_api.c | |
parent | Releasing debian version 1.32.1-2. (diff) | |
download | netdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.tar.xz netdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.zip |
Merging upstream version 1.33.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'aclk/aclk_api.c')
-rw-r--r-- | aclk/aclk_api.c | 157 |
1 files changed, 10 insertions, 147 deletions
diff --git a/aclk/aclk_api.c b/aclk/aclk_api.c index 251f5b70..172cf298 100644 --- a/aclk/aclk_api.c +++ b/aclk/aclk_api.c @@ -2,12 +2,9 @@ #include "libnetdata/libnetdata.h" #include "database/rrd.h" -#ifdef ACLK_NG +#ifdef ENABLE_ACLK #include "aclk.h" #endif -#ifdef ACLK_LEGACY -#include "legacy/agent_cloud_link.h" -#endif int aclk_connected = 0; int aclk_kill_link = 0; @@ -20,12 +17,6 @@ int aclk_disable_single_updates = 0; int aclk_stats_enabled; -#ifdef ACLK_NG -int aclk_ng = 1; -#else -int aclk_ng = 0; -#endif - #define ACLK_IMPL_KEY_NAME "aclk implementation" #ifdef ENABLE_ACLK @@ -33,41 +24,13 @@ void *aclk_starter(void *ptr) { char *aclk_impl_req = config_get(CONFIG_SECTION_CLOUD, ACLK_IMPL_KEY_NAME, "ng"); if (!strcasecmp(aclk_impl_req, "ng")) { - aclk_ng = 1; + return aclk_main(ptr); } else if (!strcasecmp(aclk_impl_req, "legacy")) { - aclk_ng = 0; + error("Legacy ACLK is not supported anymore key \"" ACLK_IMPL_KEY_NAME "\" in section \"" CONFIG_SECTION_CLOUD "\" ignored. Using ACLK-NG."); } else { - error("Unknown value \"%s\" of key \"" ACLK_IMPL_KEY_NAME "\" in section \"" CONFIG_SECTION_CLOUD "\". Trying default ACLK %s.", aclk_impl_req, aclk_ng ? "NG" : "Legacy"); - } - -#ifndef ACLK_NG - if (aclk_ng) { - error("Configuration requests ACLK-NG but it is not available in this agent. Switching to Legacy."); - aclk_ng = 0; - } -#endif - -#ifndef ACLK_LEGACY - if (!aclk_ng) { - error("Configuration requests ACLK Legacy but it is not available in this agent. Switching to NG."); - aclk_ng = 1; - } -#endif - -#ifdef ACLK_NG - if (aclk_ng) { - info("Starting ACLK-NG"); - return aclk_main(ptr); - } -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) { - info("Starting ACLK Legacy"); - return legacy_aclk_main(ptr); + error("Unknown value \"%s\" of key \"" ACLK_IMPL_KEY_NAME "\" in section \"" CONFIG_SECTION_CLOUD "\". Using ACLK-NG. This config key will be deprecated.", aclk_impl_req); } -#endif - error_report("No ACLK could be started"); - return NULL; + return aclk_main(ptr); } void aclk_single_update_disable() @@ -79,99 +42,15 @@ void aclk_single_update_enable() { aclk_disable_single_updates = 0; } - -void aclk_alarm_reload(void) -{ -#ifdef ACLK_NG - if (aclk_ng) - ng_aclk_alarm_reload(); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - legacy_aclk_alarm_reload(); -#endif -} - -int aclk_update_chart(RRDHOST *host, char *chart_name, int create) -{ -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_update_chart(host, chart_name, create); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_update_chart(host, chart_name, create); -#endif - error_report("No usable aclk_update_chart implementation"); - return 1; -} - -int aclk_update_alarm(RRDHOST *host, ALARM_ENTRY *ae) -{ -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_update_alarm(host, ae); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_update_alarm(host, ae); -#endif - error_report("No usable aclk_update_alarm implementation"); - return 1; -} - -void aclk_add_collector(RRDHOST *host, const char *plugin_name, const char *module_name) -{ -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_add_collector(host, plugin_name, module_name); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_add_collector(host, plugin_name, module_name); -#endif - error_report("No usable aclk_add_collector implementation"); -} - -void aclk_del_collector(RRDHOST *host, const char *plugin_name, const char *module_name) -{ -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_del_collector(host, plugin_name, module_name); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_del_collector(host, plugin_name, module_name); -#endif - error_report("No usable aclk_del_collector implementation"); -} - -void aclk_host_state_update(RRDHOST *host, int connect) -{ -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_host_state_update(host, connect); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_host_state_update(host, connect); -#endif - error_report("Couldn't use any version of aclk_host_state_update"); -} - #endif /* ENABLE_ACLK */ struct label *add_aclk_host_labels(struct label *label) { -#ifdef ACLK_NG +#ifdef ENABLE_ACLK label = add_label_to_list(label, "_aclk_ng_available", "true", LABEL_SOURCE_AUTO); #else label = add_label_to_list(label, "_aclk_ng_available", "false", LABEL_SOURCE_AUTO); #endif -#ifdef ACLK_LEGACY - label = add_label_to_list(label, "_aclk_legacy_available", "true", LABEL_SOURCE_AUTO); -#else label = add_label_to_list(label, "_aclk_legacy_available", "false", LABEL_SOURCE_AUTO); -#endif #ifdef ENABLE_ACLK ACLK_PROXY_TYPE aclk_proxy; char *proxy_str; @@ -189,7 +68,7 @@ struct label *add_aclk_host_labels(struct label *label) { break; } - label = add_label_to_list(label, "_aclk_impl", aclk_ng ? "Next Generation" : "Legacy", LABEL_SOURCE_AUTO); + label = add_label_to_list(label, "_aclk_impl", "Next Generation", LABEL_SOURCE_AUTO); label = add_label_to_list(label, "_aclk_proxy", proxy_str, LABEL_SOURCE_AUTO); #endif return label; @@ -199,30 +78,14 @@ char *aclk_state(void) { #ifndef ENABLE_ACLK return strdupz("ACLK Available: No"); #else -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_state(); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_state(); + return ng_aclk_state(); #endif -#endif /* ENABLE_ACLK */ - return NULL; } char *aclk_state_json(void) { #ifndef ENABLE_ACLK - return strdupz("{\"aclk-available\": false}"); + return strdupz("{\"aclk-available\":false}"); #else -#ifdef ACLK_NG - if (aclk_ng) - return ng_aclk_state_json(); -#endif -#ifdef ACLK_LEGACY - if (!aclk_ng) - return legacy_aclk_state_json(); + return ng_aclk_state_json(); #endif -#endif /* ENABLE_ACLK */ - return NULL; } |