diff --git a/net-mgmt/telegraf/Makefile b/net-mgmt/telegraf/Makefile index fc1933f0c..7bacbcd9d 100644 --- a/net-mgmt/telegraf/Makefile +++ b/net-mgmt/telegraf/Makefile @@ -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 diff --git a/net-mgmt/telegraf/src/opnsense/mvc/app/controllers/OPNsense/Telegraf/forms/output.xml b/net-mgmt/telegraf/src/opnsense/mvc/app/controllers/OPNsense/Telegraf/forms/output.xml index f87ecb7af..120056dfb 100644 --- a/net-mgmt/telegraf/src/opnsense/mvc/app/controllers/OPNsense/Telegraf/forms/output.xml +++ b/net-mgmt/telegraf/src/opnsense/mvc/app/controllers/OPNsense/Telegraf/forms/output.xml @@ -77,4 +77,28 @@ text Set the IP and port where metrics shoud be sent to. + + output.elastic_enable + + checkbox + This will enable Elasticsearch as output. Format is without square brackets, just like http://192.168.0.1:9200. + + + output.elastic_url + + text + Set the URL where metrics shoud be sent to. + + + output.elastic_timeout + + text + Write timeout (for the Elasticsearch client), formatted as a string. If not provided, will default to 5s. 0s means no timeout (not recommended). + + + output.elastic_indexname + + text + Set the index name. + diff --git a/net-mgmt/telegraf/src/opnsense/mvc/app/models/OPNsense/Telegraf/Output.xml b/net-mgmt/telegraf/src/opnsense/mvc/app/models/OPNsense/Telegraf/Output.xml index 1cf868394..53f0a26fd 100644 --- a/net-mgmt/telegraf/src/opnsense/mvc/app/models/OPNsense/Telegraf/Output.xml +++ b/net-mgmt/telegraf/src/opnsense/mvc/app/models/OPNsense/Telegraf/Output.xml @@ -1,7 +1,7 @@ //OPNsense/telegraf/output Telegraf outputs configuration - 1.2.0 + 1.3.0 0 @@ -51,5 +51,20 @@ N + + 0 + N + + + N + + + 5 + N + + + telegraf-%Y.%m.%d + N + diff --git a/net-mgmt/telegraf/src/opnsense/service/templates/OPNsense/Telegraf/telegraf.conf b/net-mgmt/telegraf/src/opnsense/service/templates/OPNsense/Telegraf/telegraf.conf index fb295f508..596167543 100644 --- a/net-mgmt/telegraf/src/opnsense/service/templates/OPNsense/Telegraf/telegraf.conf +++ b/net-mgmt/telegraf/src/opnsense/service/templates/OPNsense/Telegraf/telegraf.conf @@ -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' %}