diff options
author | Andrew Moss <1043609+amoss@users.noreply.github.com> | 2019-12-16 15:12:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-16 15:12:00 +0100 |
commit | c8c72f18a6a8fd09d3b6284e49525396b24e8395 (patch) | |
tree | 5b9aeaea7d72e1d1029d45f67c0a5f130ecc2f80 /streaming | |
parent | c4bb3d2642ab34e6aca912b22e55aed52f84e974 (diff) |
Labels issues (#7515)
Initial work on host labels from the dedicated branch. Includes work for issues #7096, #7400, #7411, #7369, #7410, #7458, #7459, #7412 and #7408 by @vlvkobal, @thiagoftsm, @cakrit and @amoss.
Diffstat (limited to 'streaming')
-rw-r--r-- | streaming/rrdpush.c | 23 | ||||
-rw-r--r-- | streaming/rrdpush.h | 1 |
2 files changed, 22 insertions, 2 deletions
diff --git a/streaming/rrdpush.c b/streaming/rrdpush.c index e6d2aca0a7..c88ee717ad 100644 --- a/streaming/rrdpush.c +++ b/streaming/rrdpush.c @@ -57,12 +57,12 @@ char *netdata_ssl_ca_file = NULL; static void load_stream_conf() { errno = 0; char *filename = strdupz_path_subpath(netdata_configured_user_config_dir, "stream.conf"); - if(!appconfig_load(&stream_config, filename, 0)) { + if(!appconfig_load(&stream_config, filename, 0, NULL)) { info("CONFIG: cannot load user config '%s'. Will try stock config.", filename); freez(filename); filename = strdupz_path_subpath(netdata_configured_stock_config_dir, "stream.conf"); - if(!appconfig_load(&stream_config, filename, 0)) + if(!appconfig_load(&stream_config, filename, 0, NULL)) info("CONFIG: cannot load stock config '%s'. Running with internal defaults.", filename); } freez(filename); @@ -151,6 +151,25 @@ static inline int should_send_chart_matching(RRDSET *st) { return(rrdset_flag_check(st, RRDSET_FLAG_UPSTREAM_SEND)); } +int configured_as_master() { + struct section *section = NULL; + int is_master = 0; + + appconfig_wrlock(&stream_config); + for (section = stream_config.sections; section; section = section->next) { + uuid_t uuid; + + if (uuid_parse(section->name, uuid) != -1 && + appconfig_get_boolean(&stream_config, section->name, "enabled", 0)) { + is_master = 1; + break; + } + } + appconfig_unlock(&stream_config); + + return is_master; +} + // checks if the current chart definition has been sent static inline int need_to_send_chart_definition(RRDSET *st) { rrdset_check_rdlock(st); diff --git a/streaming/rrdpush.h b/streaming/rrdpush.h index 7bf3db93a9..7b1acd9e11 100644 --- a/streaming/rrdpush.h +++ b/streaming/rrdpush.h @@ -13,6 +13,7 @@ extern char *default_rrdpush_send_charts_matching; extern unsigned int remote_clock_resync_iterations; extern int rrdpush_init(); +extern int configured_as_master(); extern void rrdset_done_push(RRDSET *st); extern void rrdset_push_chart_definition_now(RRDSET *st); extern void *rrdpush_sender_thread(void *ptr); |