diff options
Diffstat (limited to 'database')
-rw-r--r-- | database/rrd.h | 3 | ||||
-rw-r--r-- | database/rrdhost.c | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/database/rrd.h b/database/rrd.h index a9531286ce..21d8502340 100644 --- a/database/rrd.h +++ b/database/rrd.h @@ -245,7 +245,7 @@ void rrdlabels_copy(DICTIONARY *dst, DICTIONARY *src); void reload_host_labels(void); void rrdset_update_rrdlabels(RRDSET *st, DICTIONARY *new_rrdlabels); void rrdset_save_rrdlabels_to_sql(RRDSET *st); - +void rrdhost_set_is_parent_label(int count); int rrdlabels_unittest(void); // unfortunately this break when defined in exporting_engine.h @@ -934,6 +934,7 @@ struct rrdhost { time_t senders_connect_time; // the time the last sender was connected time_t senders_last_chart_command; // the time of the last CHART streaming command time_t senders_disconnected_time; // the time the last sender was disconnected + int senders_count; // number of senders currently streaming struct receiver_state *receiver; netdata_mutex_t receiver_lock; diff --git a/database/rrdhost.c b/database/rrdhost.c index 4a083f9c91..ef3cc0d34f 100644 --- a/database/rrdhost.c +++ b/database/rrdhost.c @@ -1306,12 +1306,28 @@ static void rrdhost_load_auto_labels(void) { health_add_host_labels(); rrdlabels_add( - labels, "_is_parent", (rrdhost_hosts_available() > 1 || configured_as_parent()) ? "true" : "false", RRDLABEL_SRC_AUTO); + labels, "_is_parent", (localhost->senders_count > 0) ? "true" : "false", RRDLABEL_SRC_AUTO); if (localhost->rrdpush_send_destination) rrdlabels_add(labels, "_streams_to", localhost->rrdpush_send_destination, RRDLABEL_SRC_AUTO); } +void rrdhost_set_is_parent_label(int count) { + DICTIONARY *labels = localhost->rrdlabels; + + if (count == 0 || count == 1) { + rrdlabels_add( + labels, "_is_parent", (count) ? "true" : "false", RRDLABEL_SRC_AUTO); + + //queue a node info +#ifdef ENABLE_ACLK + if (netdata_cloud_setting) { + aclk_queue_node_info(localhost); + } +#endif + } +} + static void rrdhost_load_config_labels(void) { int status = config_load(NULL, 1, CONFIG_SECTION_HOST_LABEL); if(!status) { |