diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2021-03-26 11:34:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 11:34:23 +0200 |
commit | 5510b429a642eb2abd8f9831ac98116c4f473325 (patch) | |
tree | 3cb94c8737b316cfd2d31bab2ca71844f4f93373 /web | |
parent | f3881e1cd1d2e67275ea4a66760c742b14ac430a (diff) |
Add a new parameter 'chart' to the /api/v1/alarm_log. (#10788)
* add a chart parameter to api alarm_log
* Use hash_chart instead
* also do the strcmp
* cleaner?
* save an if
* move simple_hash out of the loop
* Changed if
* formatting changes
* fix formating
Diffstat (limited to 'web')
-rw-r--r-- | web/api/web_api_v1.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c index 0d2a33538a..1d8217bbd1 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; } |