summaryrefslogtreecommitdiffstats
path: root/web/api/exporters
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
commit81581f9719bc56f01d5aa08952671d65fda9867a (patch)
tree0f5c6b6138bf169c23c9d24b1fc0a3521385cb18 /web/api/exporters
parentReleasing debian version 1.38.1-1. (diff)
downloadnetdata-81581f9719bc56f01d5aa08952671d65fda9867a.tar.xz
netdata-81581f9719bc56f01d5aa08952671d65fda9867a.zip
Merging upstream version 1.39.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api/exporters')
-rw-r--r--web/api/exporters/README.md4
-rw-r--r--web/api/exporters/allmetrics.c14
-rw-r--r--web/api/exporters/prometheus/README.md4
-rw-r--r--web/api/exporters/shell/README.md8
-rw-r--r--web/api/exporters/shell/allmetrics_shell.c8
5 files changed, 25 insertions, 13 deletions
diff --git a/web/api/exporters/README.md b/web/api/exporters/README.md
index 1d517a91e..4be567691 100644
--- a/web/api/exporters/README.md
+++ b/web/api/exporters/README.md
@@ -1,6 +1,10 @@
<!--
title: "Exporters"
custom_edit_url: https://github.com/netdata/netdata/edit/master/web/api/exporters/README.md
+sidebar_label: "Exporters"
+learn_status: "Published"
+learn_topic_type: "References"
+learn_rel_path: "Developers/Web/Api"
-->
# Exporters
diff --git a/web/api/exporters/allmetrics.c b/web/api/exporters/allmetrics.c
index 88065400d..cad52a7d5 100644
--- a/web/api/exporters/allmetrics.c
+++ b/web/api/exporters/allmetrics.c
@@ -39,10 +39,10 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
prometheus_prefix = global_exporting_prefix;
while(url) {
- char *value = mystrsep(&url, "&");
+ char *value = strsep_skip_consecutive_separators(&url, "&");
if (!value || !*value) continue;
- char *name = mystrsep(&value, "=");
+ char *name = strsep_skip_consecutive_separators(&value, "=");
if(!name || !*name) continue;
if(!value || !*value) continue;
@@ -90,17 +90,17 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
switch(format) {
case ALLMETRICS_JSON:
- w->response.data->contenttype = CT_APPLICATION_JSON;
+ w->response.data->content_type = CT_APPLICATION_JSON;
rrd_stats_api_v1_charts_allmetrics_json(host, filter, w->response.data);
return HTTP_RESP_OK;
case ALLMETRICS_SHELL:
- w->response.data->contenttype = CT_TEXT_PLAIN;
+ w->response.data->content_type = CT_TEXT_PLAIN;
rrd_stats_api_v1_charts_allmetrics_shell(host, filter, w->response.data);
return HTTP_RESP_OK;
case ALLMETRICS_PROMETHEUS:
- w->response.data->contenttype = CT_PROMETHEUS;
+ w->response.data->content_type = CT_PROMETHEUS;
rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(
host
, filter
@@ -113,7 +113,7 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
return HTTP_RESP_OK;
case ALLMETRICS_PROMETHEUS_ALL_HOSTS:
- w->response.data->contenttype = CT_PROMETHEUS;
+ w->response.data->content_type = CT_PROMETHEUS;
rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(
host
, filter
@@ -126,7 +126,7 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
return HTTP_RESP_OK;
default:
- w->response.data->contenttype = CT_TEXT_PLAIN;
+ w->response.data->content_type = CT_TEXT_PLAIN;
buffer_strcat(w->response.data, "Which format? '" ALLMETRICS_FORMAT_SHELL "', '" ALLMETRICS_FORMAT_PROMETHEUS "', '" ALLMETRICS_FORMAT_PROMETHEUS_ALL_HOSTS "' and '" ALLMETRICS_FORMAT_JSON "' are currently supported.");
return HTTP_RESP_BAD_REQUEST;
}
diff --git a/web/api/exporters/prometheus/README.md b/web/api/exporters/prometheus/README.md
index 1ff86f4e0..5e0f98c16 100644
--- a/web/api/exporters/prometheus/README.md
+++ b/web/api/exporters/prometheus/README.md
@@ -1,6 +1,10 @@
<!--
title: "Prometheus exporter"
custom_edit_url: https://github.com/netdata/netdata/edit/master/web/api/exporters/prometheus/README.md
+sidebar_label: "Prometheus exporter"
+learn_status: "Published"
+learn_topic_type: "References"
+learn_rel_path: "Developers/Web/Api/Exporters"
-->
# Prometheus exporter
diff --git a/web/api/exporters/shell/README.md b/web/api/exporters/shell/README.md
index a41326c9d..a17ff1148 100644
--- a/web/api/exporters/shell/README.md
+++ b/web/api/exporters/shell/README.md
@@ -1,9 +1,13 @@
<!--
-title: "shell exporter"
+title: "Shell exporter"
custom_edit_url: https://github.com/netdata/netdata/edit/master/web/api/exporters/shell/README.md
+sidebar_label: "Shell exporter"
+learn_status: "Published"
+learn_topic_type: "References"
+learn_rel_path: "Developers/Web/Api/Exporters"
-->
-# shell exporter
+# Shell exporter
Shell scripts can now query Netdata:
diff --git a/web/api/exporters/shell/allmetrics_shell.c b/web/api/exporters/shell/allmetrics_shell.c
index dded5a536..fbfd6b574 100644
--- a/web/api/exporters/shell/allmetrics_shell.c
+++ b/web/api/exporters/shell/allmetrics_shell.c
@@ -24,12 +24,12 @@ static inline size_t shell_name_copy(char *d, const char *s, size_t usable) {
void rrd_stats_api_v1_charts_allmetrics_shell(RRDHOST *host, const char *filter_string, BUFFER *wb) {
analytics_log_shell();
- SIMPLE_PATTERN *filter = simple_pattern_create(filter_string, NULL, SIMPLE_PATTERN_EXACT);
+ SIMPLE_PATTERN *filter = simple_pattern_create(filter_string, NULL, SIMPLE_PATTERN_EXACT, true);
// for each chart
RRDSET *st;
rrdset_foreach_read(st, host) {
- if (filter && !simple_pattern_matches(filter, rrdset_name(st)))
+ if (filter && !simple_pattern_matches_string(filter, st->name))
continue;
NETDATA_DOUBLE total = 0.0;
@@ -97,7 +97,7 @@ void rrd_stats_api_v1_charts_allmetrics_shell(RRDHOST *host, const char *filter_
void rrd_stats_api_v1_charts_allmetrics_json(RRDHOST *host, const char *filter_string, BUFFER *wb) {
analytics_log_json();
- SIMPLE_PATTERN *filter = simple_pattern_create(filter_string, NULL, SIMPLE_PATTERN_EXACT);
+ SIMPLE_PATTERN *filter = simple_pattern_create(filter_string, NULL, SIMPLE_PATTERN_EXACT, true);
buffer_strcat(wb, "{");
@@ -107,7 +107,7 @@ void rrd_stats_api_v1_charts_allmetrics_json(RRDHOST *host, const char *filter_s
// for each chart
RRDSET *st;
rrdset_foreach_read(st, host) {
- if (filter && !(simple_pattern_matches(filter, rrdset_id(st)) || simple_pattern_matches(filter, rrdset_name(st))))
+ if (filter && !(simple_pattern_matches_string(filter, st->id) || simple_pattern_matches_string(filter, st->name)))
continue;
if(rrdset_is_available_for_viewers(st)) {