allow slaves to push new metrics to master
Costa Tsaousis (ktsaou) committed
Jun 18, 2017 at 00:22 UTC
a6190a6ff1d59ac98efa9d6df91d39e9644a6f93
1 file changed
+15
-3
src/rrdhost.c
+15
-3
@@ -59,12 +59,18 @@ RRDHOST *rrdhost_find_by_hostname(const char *hostname, uint32_t hash) {
59
// RRDHOST - internal helpers
60
61
static inline void rrdhost_init_tags(RRDHOST *host, const char *tags) {
62
+ if(host->tags && tags && !strcmp(host->tags, tags))
63
+ return;
64
+
65
void *old = (void *)host->tags;
66
host->tags = (tags && *tags)?strdupz(tags):NULL;
67
freez(old);
68
}
69
70
static inline void rrdhost_init_hostname(RRDHOST *host, const char *hostname) {
71
+ if(host->hostname && hostname && !strcmp(host->hostname, hostname))
72
+ return;
73
+
74
void *old = host->hostname;
75
host->hostname = strdupz(hostname);
76
host->hash_hostname = simple_hash(host->hostname);
@@ -72,6 +78,9 @@ static inline void rrdhost_init_hostname(RRDHOST *host, const char *hostname) {
78
}
79
80
static inline void rrdhost_init_os(RRDHOST *host, const char *os) {
81
+ if(host->os && os && !strcmp(host->os, os))
82
+ return;
83
+
84
void *old = (void *)host->os;
85
host->os = strdupz(os?os:"unknown");
86
freez(old);
@@ -326,13 +335,16 @@ RRDHOST *rrdhost_find_or_create(
335
}
336
337
if(host->rrd_update_every != update_every)
329
- error("Host '%s' has an update frequency of %d seconds, but the wanted one is %d seconds.", host->hostname, host->rrd_update_every, update_every);
338
+ error("Host '%s' has an update frequency of %d seconds, but the wanted one is %d seconds. Restart netdata here to apply the new settings.", host->hostname, host->rrd_update_every, update_every);
339
340
if(host->rrd_history_entries < history)
332
- error("Host '%s' has history of %ld entries, but the wanted one is %ld entries.", host->hostname, host->rrd_history_entries, history);
341
+ error("Host '%s' has history of %ld entries, but the wanted one is %ld entries. Restart netdata here to apply the new settings.", host->hostname, host->rrd_history_entries, history);
342
343
if(host->rrd_memory_mode != mode)
335
- error("Host '%s' has memory mode '%s', but the wanted one is '%s'.", host->hostname, rrd_memory_mode_name(host->rrd_memory_mode), rrd_memory_mode_name(mode));
344
+ error("Host '%s' has memory mode '%s', but the wanted one is '%s'. Restart netdata here to apply the new settings.", host->hostname, rrd_memory_mode_name(host->rrd_memory_mode), rrd_memory_mode_name(mode));
345
+
346
+ // update host tags
347
+ rrdhost_init_tags(host, tags);
348
}
349
rrd_unlock();
350