X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_tsdb.c;h=b7f46f1b9abde92bae63eee39d244e7fa6380ae2;hb=c3f2d0e714514ce3fcfe0a210057d8b3a8aaf308;hp=9dff2904fbff14e81cca8dff62a5faf8d6cb800e;hpb=b421a543bd9699a0eab976248beebb1325b1ef3d;p=collectd.git diff --git a/src/write_tsdb.c b/src/write_tsdb.c index 9dff2904..b7f46f1b 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -47,7 +47,6 @@ #include "configfile.h" #include "utils_cache.h" -#include "utils_parse_option.h" #include #include @@ -368,7 +367,7 @@ static int wt_format_name(char *ret, int ret_len, if (vl->plugin_instance[0] == '\0') { ssnprintf(ret, ret_len, "%s%s.%s", prefix, vl->plugin, ds_name); - } else if (vl->type_instance == '\0') { + } else if (vl->type_instance[0] == '\0') { ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, vl->plugin_instance, vl->type_instance, ds_name); @@ -388,8 +387,8 @@ static int wt_format_name(char *ret, int ret_len, ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, vl->plugin_instance, vl->type); } else { - ssnprintf(ret, ret_len, "%s%s.%s.%s", - prefix, vl->plugin, vl->plugin_instance, vl->type_instance); + ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", + prefix, vl->plugin, vl->plugin_instance, vl->type, vl->type_instance); } sfree(temp); @@ -406,7 +405,6 @@ static int wt_send_message (const char* key, const char* value, char *tags = ""; char message[1024]; char *host_tags = cb->host_tags ? cb->host_tags : ""; - const char *message_fmt; const char *meta_tsdb = "tsdb_tags"; /* skip if value is NaN */ @@ -427,16 +425,15 @@ static int wt_send_message (const char* key, const char* value, } } - message_fmt = "put %s %u %s fqdn=%s %s %s\r\n"; - message_len = ssnprintf (message, sizeof(message), - message_fmt, - key, - (unsigned int)CDTIME_T_TO_TIME_T( - time), - value, - host, - tags, - host_tags); + message_len = ssnprintf (message, + sizeof(message), + "put %s %.0f %s fqdn=%s %s %s\r\n", + key, + CDTIME_T_TO_DOUBLE(time), + value, + host, + tags, + host_tags); sfree(temp);