diff options
author | Vladimir Kobal <vlad@prokk.net> | 2020-11-05 19:08:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 19:08:17 +0200 |
commit | 943ee2482b16a81afd54b426f4fb0952f99c48e7 (patch) | |
tree | 5603b2bbd3cba974f665699a2b132256b2dfe912 /exporting/init_connectors.c | |
parent | edd6d02dec1c65593acb9d7b98dbb3f594d58c3a (diff) |
Add HTTP and HTTPS support to the simple exporting connector (#9911)
Diffstat (limited to 'exporting/init_connectors.c')
-rw-r--r-- | exporting/init_connectors.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/exporting/init_connectors.c b/exporting/init_connectors.c index 4a68118970..57ac030d9a 100644 --- a/exporting/init_connectors.c +++ b/exporting/init_connectors.c @@ -40,15 +40,23 @@ int init_connectors(struct engine *engine) if (init_graphite_instance(instance) != 0) return 1; break; + case EXPORTING_CONNECTOR_TYPE_GRAPHITE_HTTP: + if (init_graphite_instance(instance) != 0) + return 1; + break; case EXPORTING_CONNECTOR_TYPE_JSON: if (init_json_instance(instance) != 0) return 1; break; - case EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_TELNET: + case EXPORTING_CONNECTOR_TYPE_JSON_HTTP: + if (init_json_http_instance(instance) != 0) + return 1; + break; + case EXPORTING_CONNECTOR_TYPE_OPENTSDB: if (init_opentsdb_telnet_instance(instance) != 0) return 1; break; - case EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP: + case EXPORTING_CONNECTOR_TYPE_OPENTSDB_HTTP: if (init_opentsdb_http_instance(instance) != 0) return 1; break; @@ -96,3 +104,36 @@ int init_connectors(struct engine *engine) return 0; } + +/** + * Initialize a ring buffer for a simple connector + * + * @param instance an instance data structure. + */ +void simple_connector_init(struct instance *instance) +{ + struct simple_connector_data *connector_specific_data = + (struct simple_connector_data *)instance->connector_specific_data; + + // create a ring buffer + struct simple_connector_buffer *first_buffer = NULL; + + if (instance->config.buffer_on_failures < 1) + instance->config.buffer_on_failures = 1; + + for (int i = 0; i < instance->config.buffer_on_failures; i++) { + struct simple_connector_buffer *current_buffer = callocz(1, sizeof(struct simple_connector_buffer)); + + if (!connector_specific_data->first_buffer) + first_buffer = current_buffer; + else + current_buffer->next = connector_specific_data->first_buffer; + + connector_specific_data->first_buffer = current_buffer; + } + + first_buffer->next = connector_specific_data->first_buffer; + connector_specific_data->last_buffer = connector_specific_data->first_buffer; + + return; +} |