]> arthur.barton.de Git - netdata.git/blobdiff - src/backends.c
replace strcmp() with strsame() and procfile improvements
[netdata.git] / src / backends.c
index a3b2231dbca2dc0ef77597b77b846dae564075fe..1d126a201ecf2a227cdb51055a97a44b604be7fd 100644 (file)
@@ -129,7 +129,7 @@ static inline int process_opentsdb_response(BUFFER *b) {
 }
 
 void *backends_main(void *ptr) {
-    (void)ptr;
+    struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
 
     BUFFER *b = buffer_create(1), *response = buffer_create(1);
     int (*backend_request_formatter)(BUFFER *b, const char *prefix, RRDHOST *host, const char *hostname, RRDSET *st, RRDDIM *rd, time_t after, time_t before, uint32_t options) = NULL;
@@ -169,13 +169,13 @@ void *backends_main(void *ptr) {
     if(!enabled || frequency < 1)
         goto cleanup;
 
-    if(!strcmp(source, "as collected")) {
+    if(!strsame(source, "as collected")) {
         options = BACKEND_SOURCE_DATA_AS_COLLECTED;
     }
-    else if(!strcmp(source, "average")) {
+    else if(!strsame(source, "average")) {
         options = BACKEND_SOURCE_DATA_AVERAGE;
     }
-    else if(!strcmp(source, "sum") || !strcmp(source, "volume")) {
+    else if(!strsame(source, "sum") || !strsame(source, "volume")) {
         options = BACKEND_SOURCE_DATA_SUM;
     }
     else {
@@ -183,7 +183,7 @@ void *backends_main(void *ptr) {
         goto cleanup;
     }
 
-    if(!strcmp(type, "graphite") || !strcmp(type, "graphite:plaintext")) {
+    if(!strsame(type, "graphite") || !strsame(type, "graphite:plaintext")) {
         default_port = 2003;
         if(options == BACKEND_SOURCE_DATA_AS_COLLECTED)
             backend_request_formatter = format_dimension_collected_graphite_plaintext;
@@ -192,7 +192,7 @@ void *backends_main(void *ptr) {
 
         backend_response_checker = process_graphite_response;
     }
-    else if(!strcmp(type, "opentsdb") || !strcmp(type, "opentsdb:telnet")) {
+    else if(!strsame(type, "opentsdb") || !strsame(type, "opentsdb:telnet")) {
         default_port = 4242;
         if(options == BACKEND_SOURCE_DATA_AS_COLLECTED)
             backend_request_formatter = format_dimension_collected_opentsdb_telnet;
@@ -543,6 +543,7 @@ cleanup:
 
     info("BACKEND thread exiting");
 
+    static_thread->enabled = 0;
     pthread_exit(NULL);
     return NULL;
 }