ChangeLog: Import changes from the wiki.
[collectd.git] / src / write_sensu.c
index aef97e5..cb0c2fe 100644 (file)
@@ -469,7 +469,7 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
        // calculate the value and set to a string
        if (ds->ds[index].type == DS_TYPE_GAUGE) {
                double tmp_v = (double) vl->values[index].gauge;
-               res = asprintf(&value_str, "%.8f", tmp_v, sensu_tags);
+               res = asprintf(&value_str, "%.8f", tmp_v);
                if (res == -1) {
                        free(ret_str);
                        ERROR("write_sensu plugin: Unable to alloc memory");
@@ -477,25 +477,36 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
                }
        } else if (rates != NULL) {
                double tmp_v = (double) rates[index];
-               res = asprintf(&value_str, "%.8f", tmp_v, sensu_tags);
+               res = asprintf(&value_str, "%.8f", tmp_v);
                if (res == -1) {
                        free(ret_str);
                        ERROR("write_sensu plugin: Unable to alloc memory");
                        return NULL;
                }
        } else {
-               int64_t tmp_v;
-               if (ds->ds[index].type == DS_TYPE_DERIVE)
-                       tmp_v = (int64_t) vl->values[index].derive;
-               else if (ds->ds[index].type == DS_TYPE_ABSOLUTE)
-                       tmp_v = (int64_t) vl->values[index].absolute;
-               else
-                       tmp_v = (int64_t) vl->values[index].counter;
-               res = asprintf(&value_str, "%lld", tmp_v, sensu_tags);
-               if (res == -1) {
-                       free(ret_str);
-                       ERROR("write_sensu plugin: Unable to alloc memory");
-                       return NULL;
+               if (ds->ds[index].type == DS_TYPE_DERIVE) {
+                       res = asprintf(&value_str, "%"PRIi64, vl->values[index].derive);
+                       if (res == -1) {
+                               free(ret_str);
+                               ERROR("write_sensu plugin: Unable to alloc memory");
+                               return NULL;
+                       }
+               }
+               else if (ds->ds[index].type == DS_TYPE_ABSOLUTE) {
+                       res = asprintf(&value_str, "%"PRIu64, vl->values[index].absolute);
+                       if (res == -1) {
+                               free(ret_str);
+                               ERROR("write_sensu plugin: Unable to alloc memory");
+                               return NULL;
+                       }
+               }
+               else {
+                       res = asprintf(&value_str, "%llu", vl->values[index].counter);
+                       if (res == -1) {
+                               free(ret_str);
+                               ERROR("write_sensu plugin: Unable to alloc memory");
+                               return NULL;
+                       }
                }
        }