summaryrefslogtreecommitdiffstats
path: root/web/api/formatters/charts2json.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/formatters/charts2json.c')
-rw-r--r--web/api/formatters/charts2json.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/web/api/formatters/charts2json.c b/web/api/formatters/charts2json.c
index db3ef37ea..856ffb5eb 100644
--- a/web/api/formatters/charts2json.c
+++ b/web/api/formatters/charts2json.c
@@ -4,7 +4,7 @@
// generate JSON for the /api/v1/charts API call
-static inline const char* get_release_channel() {
+const char* get_release_channel() {
static int use_stable = -1;
if (use_stable == -1) {
@@ -36,7 +36,7 @@ static inline const char* get_release_channel() {
return (use_stable)?"stable":"nightly";
}
-void charts2json(RRDHOST *host, BUFFER *wb) {
+void charts2json(RRDHOST *host, BUFFER *wb, int skip_volatile, int show_archived) {
static char *custom_dashboard_info_js_filename = NULL;
size_t c, dimensions = 0, memory = 0, alarms = 0;
RRDSET *st;
@@ -71,12 +71,12 @@ void charts2json(RRDHOST *host, BUFFER *wb) {
c = 0;
rrdhost_rdlock(host);
rrdset_foreach_read(st, host) {
- if(rrdset_is_available_for_viewers(st)) {
+ if ((!show_archived && rrdset_is_available_for_viewers(st)) || (show_archived && rrdset_is_archived(st))) {
if(c) buffer_strcat(wb, ",");
buffer_strcat(wb, "\n\t\t\"");
buffer_strcat(wb, st->id);
buffer_strcat(wb, "\": ");
- rrdset2json(st, wb, &dimensions, &memory);
+ rrdset2json(st, wb, &dimensions, &memory, skip_volatile);
c++;
st->last_accessed_time = now;
@@ -111,7 +111,7 @@ void charts2json(RRDHOST *host, BUFFER *wb) {
size_t found = 0;
RRDHOST *h;
rrdhost_foreach_read(h) {
- if(!rrdhost_should_be_removed(h, host, now)) {
+ if(!rrdhost_should_be_removed(h, host, now) && !rrdhost_flag_check(h, RRDHOST_FLAG_ARCHIVED)) {
buffer_sprintf(wb
, "%s\n\t\t{"
"\n\t\t\t\"hostname\": \"%s\""