summaryrefslogtreecommitdiffstats
path: root/web/api/web_api_v1.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/web_api_v1.c')
-rw-r--r--web/api/web_api_v1.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c
index 73ac15d30..1d8217bbd 100644
--- a/web/api/web_api_v1.c
+++ b/web/api/web_api_v1.c
@@ -276,6 +276,7 @@ inline int web_client_api_request_v1_alarm_count(RRDHOST *host, struct web_clien
inline int web_client_api_request_v1_alarm_log(RRDHOST *host, struct web_client *w, char *url) {
uint32_t after = 0;
+ char *chart = NULL;
while(url) {
char *value = mystrsep(&url, "&");
@@ -285,12 +286,13 @@ inline int web_client_api_request_v1_alarm_log(RRDHOST *host, struct web_client
if(!name || !*name) continue;
if(!value || !*value) continue;
- if(!strcmp(name, "after")) after = (uint32_t)strtoul(value, NULL, 0);
+ if (!strcmp(name, "after")) after = (uint32_t)strtoul(value, NULL, 0);
+ else if (!strcmp(name, "chart")) chart = value;
}
buffer_flush(w->response.data);
w->response.data->contenttype = CT_APPLICATION_JSON;
- health_alarm_log2json(host, w->response.data, after);
+ health_alarm_log2json(host, w->response.data, after, chart);
return HTTP_RESP_OK;
}
@@ -511,6 +513,10 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c
rrdhost_unlock(host);
if (likely(context_param_list && context_param_list->rd)) // Just set the first one
st = context_param_list->rd->rrdset;
+ else {
+ if (!chart_label_key)
+ sql_build_context_param_list(&context_param_list, host, context, NULL);
+ }
}
else {
st = rrdset_find(host, chart);
@@ -518,6 +524,17 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c
st = rrdset_find_byname(host, chart);
if (likely(st))
st->last_accessed_time = now_realtime_sec();
+ else
+ sql_build_context_param_list(&context_param_list, host, NULL, chart);
+ }
+
+ if (!st) {
+ if (likely(context_param_list && context_param_list->rd && context_param_list->rd->rrdset))
+ st = context_param_list->rd->rrdset;
+ else {
+ free_context_param_list(&context_param_list);
+ context_param_list = NULL;
+ }
}
if (!st && !context_param_list) {
@@ -961,6 +978,11 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb)
#ifdef ENABLE_ACLK
buffer_strcat(wb, "\t\"cloud-available\": true,\n");
+#ifdef ACLK_NG
+ buffer_strcat(wb, "\t\"aclk-implementation\": \"Next Generation\",\n");
+#else
+ buffer_strcat(wb, "\t\"aclk-implementation\": \"legacy\",\n");
+#endif
#else
buffer_strcat(wb, "\t\"cloud-available\": false,\n");
#endif