// 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");
} 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);