}
w->response.data->contenttype = CT_APPLICATION_JSON;
+ st->last_accessed_time = now_realtime_sec();
callback(st, w->response.data);
return 200;
format = ALLMETRICS_SHELL;
else if(!strcmp(value, ALLMETRICS_FORMAT_PROMETHEUS))
format = ALLMETRICS_PROMETHEUS;
+ else if(!strcmp(value, ALLMETRICS_FORMAT_JSON))
+ format = ALLMETRICS_JSON;
else
format = 0;
}
buffer_no_cacheable(w->response.data);
switch(format) {
+ case ALLMETRICS_JSON:
+ w->response.data->contenttype = CT_APPLICATION_JSON;
+ rrd_stats_api_v1_charts_allmetrics_json(host, w->response.data);
+ return 200;
+
case ALLMETRICS_SHELL:
w->response.data->contenttype = CT_TEXT_PLAIN;
rrd_stats_api_v1_charts_allmetrics_shell(host, w->response.data);
default:
w->response.data->contenttype = CT_TEXT_PLAIN;
- buffer_strcat(w->response.data, "Which format? Only '" ALLMETRICS_FORMAT_SHELL "' and '" ALLMETRICS_FORMAT_PROMETHEUS "' is currently supported.");
+ buffer_strcat(w->response.data, "Which format? '" ALLMETRICS_FORMAT_SHELL "', '" ALLMETRICS_FORMAT_PROMETHEUS "' and '" ALLMETRICS_FORMAT_JSON "' are currently supported.");
return 400;
}
}
ret = 200;
goto cleanup;
}
+ st->last_accessed_time = now_realtime_sec();
RRDCALC *rc = NULL;
if(alarm) {
// if the collected value is too old, don't calculate its value
if (rrdset_last_entry_t(st) >= (now_realtime_sec() - (st->update_every * st->gap_when_lost_iterations_above)))
- ret = rrd2value(st,
- w->response.data,
- &n,
- (dimensions) ? buffer_tostring(dimensions) : NULL,
- points,
- after,
- before,
- group,
- options,
- NULL,
- &latest_timestamp,
- &value_is_null);
+ ret = rrdset2value_api_v1(st, w->response.data, &n, (dimensions) ? buffer_tostring(dimensions) : NULL
+ , points, after, before, group, options, NULL, &latest_timestamp, &value_is_null);
// if the value cannot be calculated, show empty badge
if (ret != 200) {
ret = 404;
goto cleanup;
}
+ st->last_accessed_time = now_realtime_sec();
long long before = (before_str && *before_str)?str2l(before_str):0;
long long after = (after_str && *after_str) ?str2l(after_str):0;
buffer_strcat(w->response.data, "(");
}
- ret = rrd2format(st, w->response.data, dimensions, format, points, after, before, group, options, &last_timestamp_in_data);
+ ret = rrdset2anything_api_v1(st, w->response.data, dimensions, format, points, after, before, group, options
+ , &last_timestamp_in_data);
if(format == DATASOURCE_DATATABLE_JSONP) {
if(google_timestamp < last_timestamp_in_data)