summaryrefslogtreecommitdiffstats
path: root/exporting/read_config.c
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2020-11-05 19:08:17 +0200
committerGitHub <noreply@github.com>2020-11-05 19:08:17 +0200
commit943ee2482b16a81afd54b426f4fb0952f99c48e7 (patch)
tree5603b2bbd3cba974f665699a2b132256b2dfe912 /exporting/read_config.c
parentedd6d02dec1c65593acb9d7b98dbb3f594d58c3a (diff)
Add HTTP and HTTPS support to the simple exporting connector (#9911)
Diffstat (limited to 'exporting/read_config.c')
-rw-r--r--exporting/read_config.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/exporting/read_config.c b/exporting/read_config.c
index 1450d3036d..2b6cec6a9a 100644
--- a/exporting/read_config.c
+++ b/exporting/read_config.c
@@ -135,13 +135,20 @@ EXPORTING_CONNECTOR_TYPE exporting_select_type(const char *type)
{
if (!strcmp(type, "graphite") || !strcmp(type, "graphite:plaintext")) {
return EXPORTING_CONNECTOR_TYPE_GRAPHITE;
- } else if (!strcmp(type, "opentsdb") || !strcmp(type, "opentsdb:telnet")) {
- return EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_TELNET;
- } else if (!strcmp(type, "opentsdb:http") || !strcmp(type, "opentsdb:https")) {
- return EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP;
+ } else if (!strcmp(type, "graphite:http") || !strcmp(type, "graphite:https")) {
+ return EXPORTING_CONNECTOR_TYPE_GRAPHITE_HTTP;
} else if (!strcmp(type, "json") || !strcmp(type, "json:plaintext")) {
return EXPORTING_CONNECTOR_TYPE_JSON;
- } else if (!strcmp(type, "prometheus_remote_write")) {
+ } else if (!strcmp(type, "json:http") || !strcmp(type, "json:https")) {
+ return EXPORTING_CONNECTOR_TYPE_JSON_HTTP;
+ } else if (!strcmp(type, "opentsdb") || !strcmp(type, "opentsdb:telnet")) {
+ return EXPORTING_CONNECTOR_TYPE_OPENTSDB;
+ } else if (!strcmp(type, "opentsdb:http") || !strcmp(type, "opentsdb:https")) {
+ return EXPORTING_CONNECTOR_TYPE_OPENTSDB_HTTP;
+ } else if (
+ !strcmp(type, "prometheus_remote_write") ||
+ !strcmp(type, "prometheus_remote_write:http") ||
+ !strcmp(type, "prometheus_remote_write:https")) {
return EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE;
} else if (!strcmp(type, "kinesis") || !strcmp(type, "kinesis:plaintext")) {
return EXPORTING_CONNECTOR_TYPE_KINESIS;
@@ -432,7 +439,22 @@ struct engine *read_exporting_config()
tmp_instance->config.prefix = strdupz(exporter_get(instance_name, "prefix", "netdata"));
#ifdef ENABLE_HTTPS
- if (tmp_instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && !strncmp(tmp_ci_list->local_ci.connector_name, "opentsdb:https", 14)) {
+
+#define STR_GRAPHITE_HTTPS "graphite:https"
+#define STR_JSON_HTTPS "json:https"
+#define STR_OPENTSDB_HTTPS "opentsdb:https"
+#define STR_PROMETHEUS_REMOTE_WRITE_HTTPS "prometheus_remote_write:https"
+
+ if ((tmp_instance->config.type == EXPORTING_CONNECTOR_TYPE_GRAPHITE_HTTP &&
+ !strncmp(tmp_ci_list->local_ci.connector_name, STR_GRAPHITE_HTTPS, strlen(STR_GRAPHITE_HTTPS))) ||
+ (tmp_instance->config.type == EXPORTING_CONNECTOR_TYPE_JSON_HTTP &&
+ !strncmp(tmp_ci_list->local_ci.connector_name, STR_JSON_HTTPS, strlen(STR_JSON_HTTPS))) ||
+ (tmp_instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_HTTP &&
+ !strncmp(tmp_ci_list->local_ci.connector_name, STR_OPENTSDB_HTTPS, strlen(STR_OPENTSDB_HTTPS))) ||
+ (tmp_instance->config.type == EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE &&
+ !strncmp(
+ tmp_ci_list->local_ci.connector_name, STR_PROMETHEUS_REMOTE_WRITE_HTTPS,
+ strlen(STR_PROMETHEUS_REMOTE_WRITE_HTTPS)))) {
tmp_instance->config.options |= EXPORTING_OPTION_USE_TLS;
}
#endif