Do not set virtual host flag on agent restart (#20845)
Don't set virtual host flag on agent restart
Stelios Fragkakis committed
Aug 19, 2025 at 12:19 UTC
e1a864350499196cd8116f6eece15f14d33f93e1
2 files changed
+10
-10
src/database/sqlite/sqlite_aclk.c
-3
@@ -172,9 +172,6 @@ static int create_host_callback(void *data, int argc, char **argv, char **column
172
host->rrdlabels = sql_load_host_labels((nd_uuid_t *)argv[IDX_HOST_ID]);
173
host->stream.snd.status.last_connected = last_connected;
174
175
- if (argv[IDX_OS] && strcmp(argv[IDX_OS], NETDATA_VIRTUAL_HOST) == 0)
176
- rrdhost_option_set(host, RRDHOST_OPTION_VIRTUAL_HOST);
177
-
175
pulse_host_status(host, 0, 0); // this will detect the receiver status
176
}
177
src/database/sqlite/sqlite_aclk_node.c
+10
-7
@@ -65,7 +65,10 @@ static void build_node_info(RRDHOST *host)
65
now_realtime_timeval(&node_info.updated_at);
66
67
char *host_version = NULL;
68
- if (host != localhost && !rrdhost_option_check(host, RRDHOST_OPTION_VIRTUAL_HOST))
68
+ bool is_virtual_host = (rrdhost_option_check(host, RRDHOST_OPTION_VIRTUAL_HOST) ||
69
+ strcmp(string2str(host->os), NETDATA_VIRTUAL_HOST) == 0);
70
+
71
+ if (host != localhost && !is_virtual_host)
72
host_version = stream_receiver_program_version_strdupz(host);
73
74
node_info.data.name = rrdhost_hostname(host);
@@ -182,8 +185,8 @@ void aclk_check_node_info_and_collectors(void)
185
#ifdef REPLICATION_TRACKING
186
char replay_counters_txt[1024];
187
snprintfz(replay_counters_txt, sizeof(replay_counters_txt),
185
- " - REPLAY WHO RCV { %zu unknown, %zu me, %zu them, %zu finished } - "
186
- "REPLAY WHO SND { %zu unknown, %zu me, %zu them, %zu finished }",
188
+ " - REPLAY WHO RCV { %zu unknown, %zu me, %zu them, %zu finished } - "
189
+ "REPLAY WHO SND { %zu unknown, %zu me, %zu them, %zu finished }",
190
replay_counters.rcv[REPLAY_WHO_UNKNOWN], replay_counters.rcv[REPLAY_WHO_ME], replay_counters.rcv[REPLAY_WHO_THEM], replay_counters.rcv[REPLAY_WHO_FINISHED],
191
replay_counters.snd[REPLAY_WHO_UNKNOWN], replay_counters.snd[REPLAY_WHO_ME], replay_counters.snd[REPLAY_WHO_THEM], replay_counters.snd[REPLAY_WHO_FINISHED]
192
);
@@ -197,21 +200,21 @@ void aclk_check_node_info_and_collectors(void)
200
context_loading_body = string2str(context_loading_host);
201
context_loading_post = "')";
202
}
200
-
203
+
204
const char *replicating_rcv_pre = "", *replicating_rcv_body = "", *replicating_rcv_post = "";
205
if(replicating_rcv == 1) {
206
replicating_rcv_pre = " (host '";
207
replicating_rcv_body = string2str(replicating_rcv_host);
208
replicating_rcv_post = "')";
209
}
207
-
210
+
211
const char *replicating_snd_pre = "", *replicating_snd_body = "", *replicating_snd_post = "";
212
if(replicating_snd == 1) {
213
replicating_snd_pre = " (host '";
214
replicating_snd_body = string2str(replicating_snd_host);
215
replicating_snd_post = "')";
216
}
214
-
217
+
218
const char *context_pp_pre = "", *context_pp_body = "", *context_pp_post = "";
219
if(context_pp == 1) {
220
context_pp_pre = " (host '";
@@ -221,7 +224,7 @@ void aclk_check_node_info_and_collectors(void)
224
225
nd_log_limit_static_global_var(erl, 10, 100 * USEC_PER_MS);
226
nd_log_limit(&erl, NDLS_DAEMON, NDLP_INFO,
224
- "NODES INFO: %zu nodes loading contexts%s%s%s, %zu receiving replication%s%s%s, %zu sending replication%s%s%s, %zu pending context post processing%s%s%s%s",
227
+ "NODES INFO: %zu nodes loading contexts%s%s%s, %zu receiving replication%s%s%s, %zu sending replication%s%s%s, %zu pending context post processing%s%s%s%s",
228
context_loading, context_loading_pre, context_loading_body, context_loading_post,
229
replicating_rcv, replicating_rcv_pre, replicating_rcv_body, replicating_rcv_post,
230
replicating_snd, replicating_snd_pre, replicating_snd_body, replicating_snd_post,