X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_sensu.c;h=7a3e4f402f1689adda73492e3632ba57d22451c3;hb=599e3edb4905c6be61c0fc66a62be1d69a4833b3;hp=cb0c2fe2dc4ce8cac97f7cb7fc7ef7f82bdb21a5;hpb=0beb06563c5681975fd4f743c547e15f4facb29f;p=collectd.git diff --git a/src/write_sensu.c b/src/write_sensu.c index cb0c2fe2..7a3e4f40 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -468,16 +468,14 @@ 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); + 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");