diff options
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/analytics.c | 44 | ||||
-rw-r--r-- | daemon/analytics.h | 2 | ||||
-rw-r--r-- | daemon/buildinfo.c | 4 | ||||
-rw-r--r-- | daemon/commands.c | 6 | ||||
-rw-r--r-- | daemon/global_statistics.c | 182 | ||||
-rw-r--r-- | daemon/main.c | 330 | ||||
-rw-r--r-- | daemon/main.h | 2 | ||||
-rw-r--r-- | daemon/service.c | 22 | ||||
-rw-r--r-- | daemon/unit_test.c | 62 |
9 files changed, 396 insertions, 258 deletions
diff --git a/daemon/analytics.c b/daemon/analytics.c index 9323c8e8a0..d8d8f7f1f3 100644 --- a/daemon/analytics.c +++ b/daemon/analytics.c @@ -25,7 +25,7 @@ struct array_printer { void analytics_log_data(void) { netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_STREAM_ENABLED : [%s]", analytics_data.netdata_config_stream_enabled); - netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_MEMORY_MODE : [%s]", analytics_data.netdata_config_memory_mode); + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_MEMORY_MODE : [%s]", analytics_data.netdata_config_storage_engine_name); netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_EXPORTING_ENABLED : [%s]", analytics_data.netdata_config_exporting_enabled); netdata_log_debug(D_ANALYTICS, "NETDATA_EXPORTING_CONNECTORS : [%s]", analytics_data.netdata_exporting_connectors); netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_PROMETHEUS_USED : [%s]", analytics_data.netdata_allmetrics_prometheus_used); @@ -71,7 +71,7 @@ void analytics_log_data(void) void analytics_free_data(void) { freez(analytics_data.netdata_config_stream_enabled); - freez(analytics_data.netdata_config_memory_mode); + freez(analytics_data.netdata_config_storage_engine_name); freez(analytics_data.netdata_config_exporting_enabled); freez(analytics_data.netdata_exporting_connectors); freez(analytics_data.netdata_allmetrics_prometheus_used); @@ -114,7 +114,7 @@ void analytics_free_data(void) /* * Set a numeric/boolean data with a value */ -void analytics_set_data(char **name, char *value) +static void analytics_set_data(char **name, const char *value) { if (*name) { analytics_data.data_length -= strlen(*name); @@ -127,7 +127,7 @@ void analytics_set_data(char **name, char *value) /* * Set a string data with a value */ -void analytics_set_data_str(char **name, char *value) +static void analytics_set_data_str(char **name, const char *value) { size_t value_string_len; if (*name) { @@ -215,7 +215,7 @@ void analytics_mirrored_hosts(void) if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) continue; - ((host == localhost || !rrdhost_flag_check(host, RRDHOST_FLAG_ORPHAN)) ? reachable++ : unreachable++); + ((host == rrdb.localhost || !rrdhost_flag_check(host, RRDHOST_FLAG_ORPHAN)) ? reachable++ : unreachable++); count++; } @@ -235,7 +235,7 @@ void analytics_exporters(void) //decide if something else is more suitable (but probably not null) BUFFER *bi = buffer_create(1000, NULL); analytics_exporting_connectors(bi); - analytics_set_data_str(&analytics_data.netdata_exporting_connectors, (char *)buffer_tostring(bi)); + analytics_set_data_str(&analytics_data.netdata_exporting_connectors, buffer_tostring(bi)); buffer_free(bi); } @@ -272,7 +272,7 @@ void analytics_collectors(void) char name[500]; BUFFER *bt = buffer_create(1000, NULL); - rrdset_foreach_read(st, localhost) { + rrdset_foreach_read(st, rrdb.localhost) { if(!rrdset_is_available_for_viewers(st)) continue; @@ -349,7 +349,7 @@ void analytics_alarms_notifications(void) } freez(script); - analytics_set_data_str(&analytics_data.netdata_notification_methods, (char *)buffer_tostring(b)); + analytics_set_data_str(&analytics_data.netdata_notification_methods, buffer_tostring(b)); buffer_free(b); } @@ -377,15 +377,15 @@ void analytics_https(void) analytics_exporting_connectors_ssl(b); buffer_strcat(b, netdata_ssl_streaming_sender_ctx && - rrdhost_flag_check(localhost, RRDHOST_FLAG_RRDPUSH_SENDER_CONNECTED) && - SSL_connection(&localhost->sender->ssl) ? "streaming|" : "|"); + rrdhost_flag_check(rrdb.localhost, RRDHOST_FLAG_RRDPUSH_SENDER_CONNECTED) && + SSL_connection(&rrdb.localhost->sender->ssl) ? "streaming|" : "|"); buffer_strcat(b, netdata_ssl_web_server_ctx ? "web" : ""); #else buffer_strcat(b, "||"); #endif - analytics_set_data_str(&analytics_data.netdata_config_https_available, (char *)buffer_tostring(b)); + analytics_set_data_str(&analytics_data.netdata_config_https_available, buffer_tostring(b)); buffer_free(b); } @@ -394,7 +394,7 @@ void analytics_charts(void) RRDSET *st; size_t c = 0; - rrdset_foreach_read(st, localhost) + rrdset_foreach_read(st, rrdb.localhost) if(rrdset_is_available_for_viewers(st)) c++; rrdset_foreach_done(st); @@ -410,7 +410,7 @@ void analytics_metrics(void) { RRDSET *st; size_t dimensions = 0; - rrdset_foreach_read(st, localhost) { + rrdset_foreach_read(st, rrdb.localhost) { if (rrdset_is_available_for_viewers(st)) { RRDDIM *rd; rrddim_foreach_read(rd, st) { @@ -436,7 +436,7 @@ void analytics_alarms(void) size_t alarm_warn = 0, alarm_crit = 0, alarm_normal = 0; char b[21]; RRDCALC *rc; - foreach_rrdcalc_in_rrdhost_read(localhost, rc) { + foreach_rrdcalc_in_rrdhost_read(rrdb.localhost, rc) { if (unlikely(!rc->rrdset || !rc->rrdset->last_collected_time.tv_sec)) continue; @@ -650,7 +650,7 @@ static const char *verify_or_create_required_directory(const char *dir) { void set_late_global_environment(struct rrdhost_system_info *system_info) { analytics_set_data(&analytics_data.netdata_config_stream_enabled, default_rrdpush_enabled ? "true" : "false"); - analytics_set_data_str(&analytics_data.netdata_config_memory_mode, (char *)rrd_memory_mode_name(default_rrd_memory_mode)); + analytics_set_data_str(&analytics_data.netdata_config_storage_engine_name, storage_engine_name(default_storage_engine_id)); #ifdef DISABLE_CLOUD analytics_set_data(&analytics_data.netdata_host_cloud_enabled, "false"); @@ -663,10 +663,10 @@ void set_late_global_environment(struct rrdhost_system_info *system_info) #ifdef ENABLE_DBENGINE { char b[16]; - snprintfz(b, 15, "%d", default_rrdeng_page_cache_mb); + snprintfz(b, 15, "%d", rrdb.default_rrdeng_page_cache_mb); analytics_set_data(&analytics_data.netdata_config_page_cache_size, b); - snprintfz(b, 15, "%d", default_multidb_disk_quota_mb); + snprintfz(b, 15, "%d", rrdb.default_multidb_disk_quota_mb); analytics_set_data(&analytics_data.netdata_config_multidb_disk_quota, b); } #endif @@ -682,12 +682,12 @@ void set_late_global_environment(struct rrdhost_system_info *system_info) else analytics_set_data(&analytics_data.netdata_config_web_enabled, "true"); - analytics_set_data_str(&analytics_data.netdata_config_release_channel, (char *)get_release_channel()); + analytics_set_data_str(&analytics_data.netdata_config_release_channel, get_release_channel()); { BUFFER *bi = buffer_create(1000, NULL); analytics_build_info(bi); - analytics_set_data_str(&analytics_data.netdata_buildinfo, (char *)buffer_tostring(bi)); + analytics_set_data_str(&analytics_data.netdata_buildinfo, buffer_tostring(bi)); buffer_free(bi); } @@ -827,7 +827,7 @@ void set_global_environment() { { char b[16]; - snprintfz(b, 15, "%d", default_rrd_update_every); + snprintfz(b, 15, "%d", rrdb.default_update_every); setenv("NETDATA_UPDATE_EVERY", b, 1); } @@ -861,7 +861,7 @@ void set_global_environment() analytics_data.data_length = 0; analytics_set_data(&analytics_data.netdata_config_stream_enabled, "null"); - analytics_set_data(&analytics_data.netdata_config_memory_mode, "null"); + analytics_set_data(&analytics_data.netdata_config_storage_engine_name, "null"); analytics_set_data(&analytics_data.netdata_config_exporting_enabled, "null"); analytics_set_data(&analytics_data.netdata_exporting_connectors, "null"); analytics_set_data(&analytics_data.netdata_allmetrics_prometheus_used, "null"); @@ -987,7 +987,7 @@ void send_statistics(const char *action, const char *action_result, const char * action_result, action_data, analytics_data.netdata_config_stream_enabled, - analytics_data.netdata_config_memory_mode, + analytics_data.netdata_config_storage_engine_name, analytics_data.netdata_config_exporting_enabled, analytics_data.netdata_exporting_connectors, analytics_data.netdata_allmetrics_prometheus_used, diff --git a/daemon/analytics.h b/daemon/analytics.h index 34418316fc..e55850e7a5 100644 --- a/daemon/analytics.h +++ b/daemon/analytics.h @@ -22,7 +22,7 @@ struct analytics_data { char *netdata_config_stream_enabled; - char *netdata_config_memory_mode; + char *netdata_config_storage_engine_name; char *netdata_exporting_connectors; char *netdata_config_exporting_enabled; char *netdata_allmetrics_prometheus_used; diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c index 56cde84fc2..9e2d821392 100644 --- a/daemon/buildinfo.c +++ b/daemon/buildinfo.c @@ -1252,8 +1252,8 @@ static void populate_system_info(void) { struct rrdhost_system_info *system_info; bool free_system_info = false; - if(localhost && localhost->system_info) { - system_info = localhost->system_info; + if(rrdb.localhost && rrdb.localhost->system_info) { + system_info = rrdb.localhost->system_info; } else { system_info = callocz(1, sizeof(struct rrdhost_system_info)); diff --git a/daemon/commands.c b/daemon/commands.c index 84298416e6..ec99269f37 100644 --- a/daemon/commands.c +++ b/daemon/commands.c @@ -52,7 +52,7 @@ static cmd_status_t cmd_dumpconfig(char *args, char **message); static command_info_t command_info_array[] = { {"help", cmd_help_execute, CMD_TYPE_HIGH_PRIORITY}, // show help menu {"reload-health", cmd_reload_health_execute, CMD_TYPE_ORTHOGONAL}, // reload health configuration - {"save-database", cmd_save_database_execute, CMD_TYPE_ORTHOGONAL}, // save database for memory mode save + {"save-database", cmd_save_database_execute, CMD_TYPE_ORTHOGONAL}, // save database for storage engine SAVE {"reopen-logs", cmd_reopen_logs_execute, CMD_TYPE_ORTHOGONAL}, // Close and reopen log files {"shutdown-agent", cmd_exit_execute, CMD_TYPE_EXCLUSIVE}, // exit cleanly {"fatal-agent", cmd_fatal_execute, CMD_TYPE_HIGH_PRIORITY}, // exit with fatal error @@ -218,10 +218,10 @@ static cmd_status_t cmd_reload_labels_execute(char *args, char **message) { (void)args; netdata_log_info("COMMAND: reloading host labels."); - reload_host_labels(); + localhost_load_labels(); BUFFER *wb = buffer_create(10, NULL); - rrdlabels_log_to_buffer(localhost->rrdlabels, wb); + rrdlabels_log_to_buffer(rrdb.localhost->rrdlabels, wb); (*message)=strdupz(buffer_tostring(wb)); buffer_free(wb); diff --git a/daemon/global_statistics.c b/daemon/global_statistics.c index ce8d414026..8225afa8b7 100644 --- a/daemon/global_statistics.c +++ b/daemon/global_statistics.c @@ -83,7 +83,7 @@ static struct global_statistics { }; void global_statistics_rrdset_done_chart_collection_completed(size_t *points_read_per_tier_array) { - for(size_t tier = 0; tier < storage_tiers ;tier++) { + for(size_t tier = 0; tier < rrdb.storage_tiers ;tier++) { __atomic_fetch_add(&global_statistics.db_points_stored_per_tier[tier], points_read_per_tier_array[tier], __ATOMIC_RELAXED); points_read_per_tier_array[tier] = 0; } @@ -210,7 +210,7 @@ static inline void global_statistics_copy(struct global_statistics *gs, uint8_t gs->backfill_queries_made = __atomic_load_n(&global_statistics.backfill_queries_made, __ATOMIC_RELAXED); gs->backfill_db_points_read = __atomic_load_n(&global_statistics.backfill_db_points_read, __ATOMIC_RELAXED); - for(size_t tier = 0; tier < storage_tiers ;tier++) + for(size_t tier = 0; tier < rrdb.storage_tiers ;tier++) gs->db_points_stored_per_tier[tier] = __atomic_load_n(&global_statistics.db_points_stored_per_tier[tier], __ATOMIC_RELAXED); if(options & GLOBAL_STATS_RESET_WEB_USEC_MAX) { @@ -262,7 +262,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 130000 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_STACKED ); @@ -308,7 +308,7 @@ static void global_statistics_charts(void) { "netdata", "stats", 130100, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_database = rrddim_add(st_memory, "db", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -397,7 +397,7 @@ static void global_statistics_charts(void) { "netdata", "stats", 130101, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_queries = rrddim_add(st_memory_buffers, "queries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -452,7 +452,7 @@ static void global_statistics_charts(void) { "netdata", "stats", 130150, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_uptime = rrddim_add(st_uptime, "uptime", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -480,7 +480,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 130200 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -509,7 +509,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 130300 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -539,7 +539,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 130400 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_AREA ); @@ -571,7 +571,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 130500 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -618,7 +618,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 130600 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -670,7 +670,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 131000 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_STACKED ); @@ -721,7 +721,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 131001 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_STACKED ); @@ -770,7 +770,7 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 131002 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_STACKED ); @@ -810,18 +810,18 @@ static void global_statistics_charts(void) { , "netdata" , "stats" , 131003 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_STACKED ); - for(size_t tier = 0; tier < storage_tiers ;tier++) { + for(size_t tier = 0; tier < rrdb.storage_tiers ;tier++) { char buf[30 + 1]; snprintfz(buf, 30, "tier%zu", tier); rds[tier] = rrddim_add(st_points_stored, buf, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } } - for(size_t tier = 0; tier < storage_tiers ;tier++) + for(size_t tier = 0; tier < rrdb.storage_tiers ;tier++) rrddim_set_by_pointer(st_points_stored, rds[tier], (collected_number)gs.db_points_stored_per_tier[tier]); rrdset_done(st_points_stored); @@ -882,7 +882,7 @@ static inline void sqlite3_statistics_copy(struct sqlite3_statistics *gs) { gs->sqlite3_queries_failed_locked = __atomic_load_n(&sqlite3_statistics.sqlite3_queries_failed_locked, __ATOMIC_RELAXED); gs->sqlite3_rows = __atomic_load_n(&sqlite3_statistics.sqlite3_rows, __ATOMIC_RELAXED); - usec_t timeout = default_rrd_update_every * USEC_PER_SEC + default_rrd_update_every * USEC_PER_SEC / 3; + usec_t timeout = rrdb.default_update_every * USEC_PER_SEC + rrdb.default_update_every * USEC_PER_SEC / 3; usec_t now = now_monotonic_usec(); if(!last_run) last_run = now; @@ -968,7 +968,7 @@ static void sqlite3_statistics_charts(void) { , "netdata" , "stats" , 131100 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -998,7 +998,7 @@ static void sqlite3_statistics_charts(void) { , "netdata" , "stats" , 131101 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -1034,7 +1034,7 @@ static void sqlite3_statistics_charts(void) { , "netdata" , "stats" , 131102 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -1065,7 +1065,7 @@ static void sqlite3_statistics_charts(void) { , "netdata" , "stats" , 131103 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -1109,7 +1109,7 @@ static void sqlite3_statistics_charts(void) { , "netdata" , "stats" , 131104 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE ); @@ -1237,7 +1237,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); ptrs->rd_hit_ratio_closest = rrddim_add(ptrs->st_cache_hit_ratio, "closest", NULL, 1, 10000, RRD_ALGORITHM_ABSOLUTE); @@ -1285,7 +1285,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); ptrs->rd_searches_closest = rrddim_add(ptrs->st_operations, "search closest", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1339,7 +1339,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); ptrs->rd_pgc_memory_free = rrddim_add(ptrs->st_pgc_memory, "free", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1393,7 +1393,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); ptrs->rd_pgc_tm_current = rrddim_add(ptrs->st_pgc_tm, "current", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1443,7 +1443,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); ptrs->rd_pgc_pages_clean = rrddim_add(ptrs->st_pgc_pages, "clean", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1487,7 +1487,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_AREA); ptrs->rd_pgc_memory_new_clean = rrddim_add(ptrs->st_pgc_memory_changes, "new clean", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1529,7 +1529,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_AREA); ptrs->rd_pgc_memory_dirty_to_clean = rrddim_add(ptrs->st_pgc_memory_migrations, "dirty to clean", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1569,7 +1569,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_AREA); ptrs->rd_pgc_memory_evictions_aggressive = rrddim_add(ptrs->st_pgc_memory_events, "evictions aggressive", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1611,7 +1611,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); ptrs->rd_pgc_waste_evictions_skipped = rrddim_add(ptrs->st_pgc_waste, "evictions skipped", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1663,7 +1663,7 @@ static void dbengine2_cache_statistics_charts(struct dbengine2_cache_pointers *p "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); ptrs->rd_pgc_workers_searchers = rrddim_add(ptrs->st_pgc_workers, "searchers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1752,7 +1752,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_pgc_memory_main = rrddim_add(st_pgc_memory, "main cache", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1804,7 +1804,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_pgc_buffers_pgc = rrddim_add(st_pgc_buffers, "pgc", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1863,7 +1863,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_AREA); rd_julyl_moved = rrddim_add(st_julyl_moved, "moved", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1897,7 +1897,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_mrg_metrics = rrddim_add(st_mrg_metrics, "all", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -1937,7 +1937,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_mrg_add = rrddim_add(st_mrg_ops, "add", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1969,7 +1969,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_mrg_references = rrddim_add(st_mrg_references, "references", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -2000,7 +2000,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_hit_ratio = rrddim_add(st_cache_hit_ratio, "overall", NULL, 1, 10000, RRD_ALGORITHM_ABSOLUTE); @@ -2077,7 +2077,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_total = rrddim_add(st_queries, "total", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2113,7 +2113,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_queries = rrddim_add(st_queries_running, "queries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -2143,7 +2143,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_cache = rrddim_add(st_query_pages_metadata_source, "cache hit", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2177,7 +2177,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_pages_main_cache = rrddim_add(st_query_pages_data_source, "main cache", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2213,7 +2213,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_pass4 = rrddim_add(st_query_next_page, "pass4", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2254,7 +2254,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_pages_zero_time = rrddim_add(st_query_page_issues, "zero timestamp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2301,7 +2301,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_compressed = rrddim_add(st_query_pages_from_disk, "ok compressed", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2353,7 +2353,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_journal_v2_mapped = rrddim_add(st_events, "journal v2 mapped", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2397,7 +2397,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_routing = rrddim_add(st_prep_timings, "routing", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2438,7 +2438,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_STACKED); rd_init = rrddim_add(st_query_timings, "init", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2460,7 +2460,7 @@ static void dbengine2_statistics_charts(void) { rrdset_done(st_query_timings); } - if(netdata_rwlock_tryrdlock(&rrd_rwlock) == 0) { + if(rrd_tryrdlock() == 0) { priority = 135400; RRDHOST *host; @@ -2472,8 +2472,8 @@ static void dbengine2_statistics_charts(void) { if (!rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) { /* get localhost's DB engine's statistics for each tier */ - for(size_t tier = 0; tier < storage_tiers ;tier++) { - if(host->db[tier].mode != RRD_MEMORY_MODE_DBENGINE) continue; + for(size_t tier = 0; tier < rrdb.storage_tiers ;tier++) { + if(host->db[tier].id != STORAGE_ENGINE_DBENGINE) continue; if(!host->db[tier].instance) continue; if(is_storage_engine_shared(host->db[tier].instance)) { @@ -2484,7 +2484,7 @@ static void dbengine2_statistics_charts(void) { } ++dbengine_contexts; - rrdeng_get_37_statistics((struct rrdengine_instance *)host->db[tier].instance, local_stats_array); + rrdeng_get_37_statistics(host->db[tier].instance, local_stats_array); for (i = 0; i < RRDENG_NR_STATS; ++i) { /* aggregate statistics across hosts */ stats_array[i] += local_stats_array[i]; @@ -2520,7 +2520,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_savings = rrddim_add(st_compression, "savings", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE); @@ -2561,7 +2561,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_reads = rrddim_add(st_io_stats, "reads", NULL, 1, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); @@ -2593,7 +2593,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_reads = rrddim_add(st_io_stats, "reads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2626,7 +2626,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_io_errors = rrddim_add(st_errors, "io_errors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2661,7 +2661,7 @@ static void dbengine2_statistics_charts(void) { "netdata", "stats", priority, - localhost->rrd_update_every, + rrdb.localhost->update_every, RRDSET_TYPE_LINE); rd_fd_current = rrddim_add(st_fd, "current", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -2701,7 +2701,7 @@ static void update_strings_charts() { , "netdata" , "stats" , 910000 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_LINE); rd_ops_inserts = rrddim_add(st_ops, "inserts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -2730,7 +2730,7 @@ static void update_strings_charts() { , "netdata" , "stats" , 910001 - , localhost->rrd_update_every + , rrdb.localhost->update_every , RRDSET_TYPE_AREA); rd_entries_entries = rrddim_add(st_entries, "entries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -2753,7 +2753,7 @@ static void update_strings_charts() { , "net |