diff options
Diffstat (limited to 'database/rrdhost.c')
-rw-r--r-- | database/rrdhost.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/database/rrdhost.c b/database/rrdhost.c index 649736ca4..cb56bf353 100644 --- a/database/rrdhost.c +++ b/database/rrdhost.c @@ -181,6 +181,8 @@ RRDHOST *rrdhost_create(const char *hostname, host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key) ? 1 : 0; host->rrdpush_send_destination = (host->rrdpush_send_enabled)?strdupz(rrdpush_destination):NULL; + if (host->rrdpush_send_destination) + host->destinations = destinations_init(host->rrdpush_send_destination); host->rrdpush_send_api_key = (host->rrdpush_send_enabled)?strdupz(rrdpush_api_key):NULL; host->rrdpush_send_charts_matching = simple_pattern_create(rrdpush_send_charts_matching, NULL, SIMPLE_PATTERN_EXACT); @@ -390,6 +392,7 @@ RRDHOST *rrdhost_create(const char *hostname, if (is_localhost && host->system_info) { host->system_info->ml_capable = ml_capable(); host->system_info->ml_enabled = ml_enabled(host); + host->system_info->mc_version = enable_metric_correlations ? metric_correlations_version : 0; } ml_new_host(host); @@ -698,7 +701,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info) { if (gap_when_lost_iterations_above < 1) gap_when_lost_iterations_above = 1; - if (unlikely(sql_init_database(DB_CHECK_NONE))) { + if (unlikely(sql_init_database(DB_CHECK_NONE, 0))) { if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) fatal("Failed to initialize SQLite"); info("Skipping SQLITE metadata initialization since memory mode is not db engine"); @@ -1488,9 +1491,8 @@ restart_after_removal: continue; } #if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) - else { - aclk_send_dimension_update(rd); - } + else + queue_dimension_to_aclk(rd, rd->last_collected_time.tv_sec); #endif } last = rd; @@ -1528,6 +1530,18 @@ restart_after_removal: } } +void rrdset_check_obsoletion(RRDHOST *host) +{ + RRDSET *st; + time_t last_entry_t; + rrdset_foreach_read(st, host) { + last_entry_t = rrdset_last_entry_t(st); + if (last_entry_t && last_entry_t < host->senders_connect_time) { + rrdset_is_obsolete(st); + } + } +} + void rrd_cleanup_obsolete_charts() { rrd_rdlock(); @@ -1547,6 +1561,16 @@ void rrd_cleanup_obsolete_charts() #endif rrdhost_unlock(host); } + + if (host != localhost && + host->trigger_chart_obsoletion_check && + host->senders_last_chart_command && + host->senders_last_chart_command + 120 < now_realtime_sec()) { + rrdhost_rdlock(host); + rrdset_check_obsoletion(host); + rrdhost_unlock(host); + host->trigger_chart_obsoletion_check = 0; + } } rrd_unlock(); |