Enables basic HTTP Authentication agains Elasticsearch (#2703)

This commit is contained in:
Mr. Johnson
2022-06-29 21:48:54 +02:00
committed by GitHub
parent 2cc80901f8
commit 799578e942
3 changed files with 24 additions and 0 deletions
@@ -143,6 +143,18 @@
<type>text</type>
<help>Set the URL where metrics shoud be sent to.</help>
</field>
<field>
<id>output.elastic_username</id>
<label>Elasticsearch Username</label>
<type>text</type>
<help>Optional HTTP basic authentication details for Elasticsearch.</help>
</field>
<field>
<id>output.elastic_password</id>
<label>Elasticsearch Password</label>
<type>text</type>
<help>Optional HTTP basic authentication details for Elasticsearch.</help>
</field>
<field>
<id>output.elastic_timeout</id>
<label>Timeout</label>
@@ -70,6 +70,12 @@
<elastic_url type="TextField">
<Required>N</Required>
</elastic_url>
<elastic_username type="TextField">
<Required>N</Required>
</elastic_username>
<elastic_password type="TextField">
<Required>N</Required>
</elastic_password>
<elastic_timeout type="IntegerField">
<default>5</default>
<Required>N</Required>
@@ -127,6 +127,12 @@
{% if helpers.exists('OPNsense.telegraf.output.elastic_url') and OPNsense.telegraf.output.elastic_url != '' %}
urls = ["{{ OPNsense.telegraf.output.elastic_url }}"]
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.elastic_username') and OPNsense.telegraf.output.elastic_username != '' %}
{% if helpers.exists('OPNsense.telegraf.output.elastic_password') and OPNsense.telegraf.output.elastic_password != '' %}
username = "{{ OPNsense.telegraf.output.elastic_username }}"
password = "{{ OPNsense.telegraf.output.elastic_password }}"
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.elastic_timeout') and OPNsense.telegraf.output.elastic_timeout != '' %}
timeout = "{{ OPNsense.telegraf.output.elastic_timeout }}s"
{% endif %}