summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 670442e)
raw | patch | inline | side by side (parent: 670442e)
author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 24 Mar 2010 16:38:58 +0000 (17:38 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Wed, 24 Mar 2010 16:38:58 +0000 (17:38 +0100) |
This is basically the same fix as previously done for the write_http plugin.
src/utils_format_json.c | patch | blob | history |
index e8fcb35baac06cd6694f4926e18d391758b09876..69e0cd423d2f32b37fdcaed6705eab1bc9c58b69 100644 (file)
--- a/src/utils_format_json.c
+++ b/src/utils_format_json.c
else
BUFFER_ADD ("null");
}
- else if (ds->ds[i].type == DS_TYPE_COUNTER)
+ else if (store_rates)
{
- if (store_rates != 0)
+ if (rates == NULL)
+ rates = uc_get_rate (ds, vl);
+ if (rates == NULL)
{
- if (rates == NULL)
- rates = uc_get_rate (ds, vl);
- if (rates == NULL)
- {
- WARNING ("utils_format_json: "
- "uc_get_rate failed.");
- sfree(rates);
- return (-1);
- }
- if(isfinite (rates[i]))
- BUFFER_ADD ("%g", rates[i]);
- else
- BUFFER_ADD ("null");
+ WARNING ("utils_format_json: uc_get_rate failed.");
+ sfree(rates);
+ return (-1);
}
+
+ if(isfinite (rates[i]))
+ BUFFER_ADD ("%g", rates[i]);
else
- BUFFER_ADD ("%llu", vl->values[i].counter);
+ BUFFER_ADD ("null");
}
+ else if (ds->ds[i].type == DS_TYPE_COUNTER)
+ BUFFER_ADD ("%llu", vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
BUFFER_ADD ("%"PRIi64, vl->values[i].derive);
else if (ds->ds[i].type == DS_TYPE_ABSOLUTE)
{
ERROR ("format_json: Unknown data source type: %i",
ds->ds[i].type);
+ sfree (rates);
return (-1);
}
} /* for ds->ds_num */