char *value = words[2];
if(unlikely(!dimension || !*dimension)) {
- error("PLUGINSD: '%s' is requesting a SET on chart '%s', without a dimension. Disabling it.", cd->fullfilename, st->id);
+ error("PLUGINSD: '%s' is requesting a SET on chart '%s' of host '%s', without a dimension. Disabling it.", cd->fullfilename, st->id, host->hostname);
enabled = 0;
break;
}
if(unlikely(!value || !*value)) value = NULL;
if(unlikely(!st)) {
- error("PLUGINSD: '%s' is requesting a SET on dimension %s with value %s, without a BEGIN. Disabling it.", cd->fullfilename, dimension, value?value:"<nothing>");
+ error("PLUGINSD: '%s' is requesting a SET on dimension %s with value %s on host '%s', without a BEGIN. Disabling it.", cd->fullfilename, dimension, value?value:"<nothing>", host->hostname);
enabled = 0;
break;
}
char *microseconds_txt = words[2];
if(unlikely(!id)) {
- error("PLUGINSD: '%s' is requesting a BEGIN without a chart id. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting a BEGIN without a chart id for host '%s'. Disabling it.", cd->fullfilename, host->hostname);
enabled = 0;
break;
}
st = rrdset_find(host, id);
if(unlikely(!st)) {
- error("PLUGINSD: '%s' is requesting a BEGIN on chart '%s', which does not exist. Disabling it.", cd->fullfilename, id);
+ error("PLUGINSD: '%s' is requesting a BEGIN on chart '%s', which does not exist on host '%s'. Disabling it.", cd->fullfilename, id, host->hostname);
enabled = 0;
break;
}
}
else if(likely(hash == END_HASH && !strcmp(s, "END"))) {
if(unlikely(!st)) {
- error("PLUGINSD: '%s' is requesting an END, without a BEGIN. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting an END, without a BEGIN on host '%s'. Disabling it.", cd->fullfilename, host->hostname);
enabled = 0;
break;
}
char *hostname = words[2];
if(unlikely(!guid || !*guid)) {
- error("PLUGINSD: '%s' is requesting a HOST, without a guid. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting HOST with guid '%s' and hostname '%s', without a guid. Disabling it.", cd->fullfilename, guid?guid:"", hostname?hostname:"");
enabled = 0;
break;
}
if(unlikely(!hostname || !*hostname)) {
- error("PLUGINSD: '%s' is requesting a HOST, without a hostname. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting HOST with guid '%s' and hostname '%s', without a hostname. Disabling it.", cd->fullfilename, guid?guid:"", hostname?hostname:"");
enabled = 0;
break;
}
char *update_every_s = words[9];
if(unlikely(!type || !*type || !id || !*id)) {
- error("PLUGINSD: '%s' is requesting a CHART, without a type.id. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting a CHART, without a type.id, on host '%s'. Disabling it.", cd->fullfilename, host->hostname);
enabled = 0;
break;
}
char *options = words[6];
if(unlikely(!id || !*id)) {
- error("PLUGINSD: '%s' is requesting a DIMENSION, without an id. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting a DIMENSION, without an id, host '%s' and chart '%s'. Disabling it.", cd->fullfilename, host->hostname, st?st->id:"UNSET");
enabled = 0;
break;
}
if(unlikely(!st)) {
- error("PLUGINSD: '%s' is requesting a DIMENSION, without a CHART. Disabling it.", cd->fullfilename);
+ error("PLUGINSD: '%s' is requesting a DIMENSION, without a CHART, on host '%s'. Disabling it.", cd->fullfilename, host->hostname);
enabled = 0;
break;
}
RRDDIM *rd = rrddim_find(st, id);
if(unlikely(!rd)) {
rd = rrddim_add(st, id, name, multiplier, divisor, rrd_algorithm_id(algorithm));
- rd->flags = 0x00000000;
+ rrddim_flag_clear(rd, RRDDIM_FLAG_HIDDEN);
+ rrddim_flag_clear(rd, RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS);
if(options && *options) {
if(strstr(options, "hidden") != NULL) rrddim_flag_set(rd, RRDDIM_FLAG_HIDDEN);
if(strstr(options, "noreset") != NULL) rrddim_flag_set(rd, RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS);
break;
}
else {
- error("PLUGINSD: '%s' is sending command '%s' which is not known by netdata. Disabling it.", cd->fullfilename, s);
+ error("PLUGINSD: '%s' is sending command '%s' which is not known by netdata, for host '%s'. Disabling it.", cd->fullfilename, s, host->hostname);
enabled = 0;
break;
}
pthread_mutex_unlock(&rrdpush_mutex);
}
-static inline int need_to_send_chart_definitions(RRDSET *st) {
+static inline int need_to_send_chart_definition(RRDSET *st) {
RRDDIM *rd;
rrddim_foreach_read(rd, st)
- if(rrddim_flag_check(rd, RRDDIM_FLAG_UPDATED) && !rrddim_flag_check(rd, RRDDIM_FLAG_EXPOSED))
+ if(!rrddim_flag_check(rd, RRDDIM_FLAG_EXPOSED))
return 1;
+
+ // fprintf(stderr, "NOT Sending CHART '%s' '%s'\n", st->id, st->name);
return 0;
}
-static inline void send_chart_definitions(RRDSET *st) {
+static inline void send_chart_definition(RRDSET *st) {
+ // fprintf(stderr, "Sending CHART '%s' '%s'\n", st->id, st->name);
+
buffer_sprintf(rrdpush_buffer, "CHART '%s' '%s' '%s' '%s' '%s' '%s' '%s' %ld %d\n"
, st->id
, st->name
RRDDIM *rd;
rrddim_foreach_read(rd, st) {
- if(rrddim_flag_check(rd, RRDDIM_FLAG_UPDATED))
+ if(rrddim_flag_check(rd, RRDDIM_FLAG_UPDATED) && rrddim_flag_check(rd, RRDDIM_FLAG_EXPOSED))
buffer_sprintf(rrdpush_buffer, "SET %s = " COLLECTED_NUMBER_FORMAT "\n"
, rd->id
, rd->collected_value
last_host = st->rrdhost;
}
- if(need_to_send_chart_definitions(st))
- send_chart_definitions(st);
+ if(need_to_send_chart_definition(st))
+ send_chart_definition(st);
send_chart_metrics(st);
ifd = &fds[0];
ofd = &fds[1];
- ifd->fd = rrdpush_pipe[PIPE_READ];
- ifd->events = POLLIN;
- ofd->events = POLLOUT;
-
- nfds_t fdmax = 2;
-
for(;;) {
if(netdata_exit) break;
sent_connection = 0;
}
+ ifd->fd = rrdpush_pipe[PIPE_READ];
+ ifd->events = POLLIN;
ifd->revents = 0;
- ofd->revents = 0;
+
ofd->fd = sock;
+ ofd->events = POLLOUT;
+ ofd->revents = 0;
+
+ nfds_t fdmax = 2;
if(begin < buffer_strlen(rrdpush_buffer))
ofd->events = POLLOUT;
}
if(ofd->revents & POLLOUT && begin < buffer_strlen(rrdpush_buffer)) {
+ // info("PUSH: send buffer is ready, sending %zu bytes starting at %zu", buffer_strlen(rrdpush_buffer) - begin, begin);
+
// fprintf(stderr, "PUSH BEGIN\n");
// fwrite(&rrdpush_buffer->buffer[begin], 1, buffer_strlen(rrdpush_buffer) - begin, stderr);
// fprintf(stderr, "\nPUSH END\n");