summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0beb065)
raw | patch | inline | side by side (parent: 0beb065)
author | Florian Forster <octo@collectd.org> | |
Fri, 22 May 2015 09:48:17 +0000 (11:48 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 22 May 2015 09:48:17 +0000 (11:48 +0200) |
Issue #1039
src/write_sensu.c | patch | blob | history | |
src/write_tsdb.c | patch | blob | history |
diff --git a/src/write_sensu.c b/src/write_sensu.c
index cb0c2fe2dc4ce8cac97f7cb7fc7ef7f82bdb21a5..7a3e4f402f1689adda73492e3632ba57d22451c3 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
// 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);
+ res = asprintf(&value_str, GAUGE_FORMAT, vl->values[index].gauge);
if (res == -1) {
free(ret_str);
ERROR("write_sensu plugin: Unable to alloc memory");
return NULL;
}
} else if (rates != NULL) {
- double tmp_v = (double) rates[index];
- res = asprintf(&value_str, "%.8f", tmp_v);
+ res = asprintf(&value_str, GAUGE_FORMAT, rates[index]);
if (res == -1) {
free(ret_str);
ERROR("write_sensu plugin: Unable to alloc memory");
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index 9008a67bf921b97a39525f16121d64916dcc212c..27ea4738051c9d6f6192b5cb76149816a5831c8a 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
} while (0)
if (ds->ds[ds_num].type == DS_TYPE_GAUGE)
- BUFFER_ADD("%f", vl->values[ds_num].gauge);
+ BUFFER_ADD(GAUGE_FORMAT, vl->values[ds_num].gauge);
else if (store_rates)
{
if (rates == NULL)
"uc_get_rate failed.");
return -1;
}
- BUFFER_ADD("%f", rates[ds_num]);
+ BUFFER_ADD(GAUGE_FORMAT, rates[ds_num]);
}
else if (ds->ds[ds_num].type == DS_TYPE_COUNTER)
BUFFER_ADD("%llu", vl->values[ds_num].counter);