net-mgmt/telegraf: add elasticsearch output (#782)

This commit is contained in:
Michael
2018-08-12 14:09:37 +02:00
committed by Franco Fichtner
parent a0483bad7d
commit c6c00d6a5a
4 changed files with 54 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= telegraf
PLUGIN_VERSION= 1.4.0
PLUGIN_VERSION= 1.5.0
PLUGIN_COMMENT= Agent for collecting metrics and data
PLUGIN_DEPENDS= telegraf
PLUGIN_MAINTAINER= m.muenz@gmail.com
@@ -77,4 +77,28 @@
<type>text</type>
<help>Set the IP and port where metrics shoud be sent to.</help>
</field>
<field>
<id>output.elastic_enable</id>
<label>Enable Elasticsearch Output</label>
<type>checkbox</type>
<help>This will enable Elasticsearch as output. Format is without square brackets, just like http://192.168.0.1:9200.</help>
</field>
<field>
<id>output.elastic_url</id>
<label>Elasticsearch URL</label>
<type>text</type>
<help>Set the URL where metrics shoud be sent to.</help>
</field>
<field>
<id>output.elastic_timeout</id>
<label>Timeout</label>
<type>text</type>
<help>Write timeout (for the Elasticsearch client), formatted as a string. If not provided, will default to 5s. 0s means no timeout (not recommended).</help>
</field>
<field>
<id>output.elastic_indexname</id>
<label>Index Name</label>
<type>text</type>
<help>Set the index name.</help>
</field>
</form>
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/telegraf/output</mount>
<description>Telegraf outputs configuration</description>
<version>1.2.0</version>
<version>1.3.0</version>
<items>
<influx_enable type="BooleanField">
<default>0</default>
@@ -51,5 +51,20 @@
<graylog_server type="TextField">
<Required>N</Required>
</graylog_server>
<elastic_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</elastic_enable>
<elastic_url type="TextField">
<Required>N</Required>
</elastic_url>
<elastic_timeout type="IntegerField">
<default>5</default>
<Required>N</Required>
</elastic_timeout>
<elastic_indexname type="TextField">
<default>telegraf-%Y.%m.%d</default>
<Required>N</Required>
</elastic_indexname>
</items>
</model>
@@ -83,6 +83,19 @@
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.elastic_enable') and OPNsense.telegraf.output.elastic_enable == '1' %}
[[outputs.elasticsearch]]
{% 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_timeout') and OPNsense.telegraf.output.elastic_timeout != '' %}
timeout = "{{ OPNsense.telegraf.output.elastic_timeout }}s"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.elastic_indexname') and OPNsense.telegraf.output.elastic_indexname != '' %}
index_name = "{{ OPNsense.telegraf.output.elastic_indexname }}"
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.input.cpu') and OPNsense.telegraf.input.cpu == '1' %}
[[inputs.cpu]]
{% if helpers.exists('OPNsense.telegraf.input.cpu_percpu') and OPNsense.telegraf.input.cpu_percpu == '1' %}