]> arthur.barton.de Git - netdata.git/blobdiff - src/plugins_d.c
dns_query_time plugin: replace "." with "_" in dimensions
[netdata.git] / src / plugins_d.c
index c7a3dac7e16d058c91802d34e142899eb2b2d882..7fa19eaf05467266beaeab5df8f933a5dc6a2542 100644 (file)
@@ -96,7 +96,7 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
     char line[PLUGINSD_LINE_MAX + 1];
 
     char *words[MAX_WORDS] = { NULL };
-    uint32_t HOST_HASH = simple_hash("HOST");
+    /* uint32_t HOST_HASH = simple_hash("HOST"); */
     uint32_t BEGIN_HASH = simple_hash("BEGIN");
     uint32_t END_HASH = simple_hash("END");
     uint32_t FLUSH_HASH = simple_hash("FLUSH");
@@ -144,7 +144,7 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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;
             }
@@ -152,7 +152,7 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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;
             }
@@ -166,14 +166,14 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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;
             }
@@ -193,7 +193,7 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
         }
         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;
             }
@@ -205,23 +205,23 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
 
             count++;
         }
-        else if(likely(hash == HOST_HASH && !strcmp(s, "HOST"))) {
+/*        else if(likely(hash == HOST_HASH && !strcmp(s, "HOST"))) {
             char *guid = words[1];
             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;
             }
 
             host = rrdhost_find_or_create(hostname, guid);
-        }
+        } */
         else if(likely(hash == FLUSH_HASH && !strcmp(s, "FLUSH"))) {
             debug(D_PLUGINSD, "PLUGINSD: '%s' is requesting a FLUSH", cd->fullfilename);
             st = NULL;
@@ -249,7 +249,7 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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;
             }
@@ -294,13 +294,13 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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;
             }
@@ -329,7 +329,8 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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);
@@ -345,7 +346,7 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
             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;
         }
@@ -454,14 +455,14 @@ void *pluginsd_main(void *ptr) {
     if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
         error("Cannot set pthread cancel state to ENABLE.");
 
-    int automatic_run = config_get_boolean("plugins", "enable running new plugins", 1);
-    int scan_frequency = (int) config_get_number("plugins", "check for new plugins every", 60);
+    int automatic_run = config_get_boolean(CONFIG_SECTION_PLUGINS, "enable running new plugins", 1);
+    int scan_frequency = (int) config_get_number(CONFIG_SECTION_PLUGINS, "check for new plugins every", 60);
     DIR *dir = NULL;
     struct dirent *file = NULL;
     struct plugind *cd;
 
     // enable the apps plugin by default
-    // config_get_boolean("plugins", "apps", 1);
+    // config_get_boolean(CONFIG_SECTION_PLUGINS, "apps", 1);
 
     if(scan_frequency < 1) scan_frequency = 1;
 
@@ -490,7 +491,7 @@ void *pluginsd_main(void *ptr) {
 
             char pluginname[CONFIG_MAX_NAME + 1];
             snprintfz(pluginname, CONFIG_MAX_NAME, "%.*s", (int)(len - PLUGINSD_FILE_SUFFIX_LEN), file->d_name);
-            int enabled = config_get_boolean("plugins", pluginname, automatic_run);
+            int enabled = config_get_boolean(CONFIG_SECTION_PLUGINS, pluginname, automatic_run);
 
             if(unlikely(!enabled)) {
                 debug(D_PLUGINSD, "PLUGINSD: plugin '%s' is not enabled", file->d_name);