diff options
Diffstat (limited to 'web/api/exporters')
-rw-r--r-- | web/api/exporters/shell/allmetrics_shell.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/web/api/exporters/shell/allmetrics_shell.c b/web/api/exporters/shell/allmetrics_shell.c index 0b0ce2291..0cbaf3069 100644 --- a/web/api/exporters/shell/allmetrics_shell.c +++ b/web/api/exporters/shell/allmetrics_shell.c @@ -107,22 +107,23 @@ void rrd_stats_api_v1_charts_allmetrics_json(RRDHOST *host, BUFFER *wb) { if(rrdset_is_available_for_viewers(st)) { rrdset_rdlock(st); - buffer_sprintf(wb, "%s\n" - "\t\"%s\": {\n" - "\t\t\"name\":\"%s\",\n" - "\t\t\"family\":\"%s\",\n" - "\t\t\"context\":\"%s\",\n" - "\t\t\"units\":\"%s\",\n" - "\t\t\"last_updated\": %ld,\n" - "\t\t\"dimensions\": {" - , chart_counter?",":"" - , st->id - , st->name - , st->family - , st->context - , st->units - , rrdset_last_entry_t_nolock(st) - ); + buffer_sprintf( + wb, + "%s\n" + "\t\"%s\": {\n" + "\t\t\"name\":\"%s\",\n" + "\t\t\"family\":\"%s\",\n" + "\t\t\"context\":\"%s\",\n" + "\t\t\"units\":\"%s\",\n" + "\t\t\"last_updated\": %"PRId64",\n" + "\t\t\"dimensions\": {", + chart_counter ? "," : "", + st->id, + st->name, + st->family, + st->context, + st->units, + (int64_t)rrdset_last_entry_t_nolock(st)); chart_counter++; dimension_counter = 0; @@ -131,15 +132,15 @@ void rrd_stats_api_v1_charts_allmetrics_json(RRDHOST *host, BUFFER *wb) { RRDDIM *rd; rrddim_foreach_read(rd, st) { if(rd->collections_counter && !rrddim_flag_check(rd, RRDDIM_FLAG_OBSOLETE)) { - - buffer_sprintf(wb, "%s\n" - "\t\t\t\"%s\": {\n" - "\t\t\t\t\"name\": \"%s\",\n" - "\t\t\t\t\"value\": " - , dimension_counter?",":"" - , rd->id - , rd->name - ); + buffer_sprintf( + wb, + "%s\n" + "\t\t\t\"%s\": {\n" + "\t\t\t\t\"name\": \"%s\",\n" + "\t\t\t\t\"value\": ", + dimension_counter ? "," : "", + rd->id, + rd->name); if(isnan(rd->last_stored_value)) buffer_strcat(wb, "null"); |