Add header config to OpenTelemetry output and fix service_address string

This commit is contained in:
thomas.laerm 2026-05-19 00:12:03 +02:00
parent 4b94d331ae
commit 5541b58c04
No known key found for this signature in database
GPG key ID: C9D95C518133EEF3
5 changed files with 32 additions and 5 deletions

View file

@ -1,5 +1,5 @@
PLUGIN_NAME= telegraf
PLUGIN_VERSION= 1.12.14
PLUGIN_VERSION= 1.12.15
PLUGIN_COMMENT= Agent for collecting metrics and data
PLUGIN_DEPENDS= telegraf
PLUGIN_MAINTAINER= m.muenz@gmail.com

View file

@ -12,6 +12,11 @@ WWW: https://www.influxdata.com/time-series-platform/telegraf/
Plugin Changelog
================
1.12.15
* Add custom header support for OpenTelemetry output
* Quote OpenTelemetry service_address in config
1.12.14
* Add name_prefix in influxdb config

View file

@ -347,7 +347,7 @@
<id>output.opentelemetry_server</id>
<label>OpenTelemetry Server</label>
<type>text</type>
<help>Set the IP and port where metrics shoud be sent to, e.g. 192.168.0.1:4317.</help>
<help>For gRPC, set the address and port, e.g. 192.168.0.1:4317. For HTTP, use a full URL, e.g. https://collector.example.com/v1/metrics.</help>
</field>
<field>
<id>output.opentelemetry_compression</id>
@ -367,4 +367,16 @@
<type>checkbox</type>
<help>This will skip chain and host verification.</help>
</field>
<field>
<id>output.opentelemetry_header_name</id>
<label>Custom Header Name</label>
<type>text</type>
<help>Name of an additional HTTP header to send with requests, e.g. Authorization.</help>
</field>
<field>
<id>output.opentelemetry_header_value</id>
<label>Custom Header Value</label>
<type>text</type>
<help>Value for the custom header, e.g. Bearer your-token-here.</help>
</field>
</form>

View file

@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/telegraf/output</mount>
<description>Telegraf outputs configuration</description>
<version>1.4.6</version>
<version>1.4.7</version>
<items>
<influx_enable type="BooleanField">
<Default>0</Default>
@ -204,5 +204,11 @@
<none>none</none>
</OptionValues>
</opentelemetry_compression>
<opentelemetry_header_name type="TextField">
<Required>N</Required>
</opentelemetry_header_name>
<opentelemetry_header_value type="TextField">
<Required>N</Required>
</opentelemetry_header_value>
</items>
</model>

View file

@ -143,7 +143,7 @@
{% if helpers.exists('OPNsense.telegraf.output.opentelemetry_enable') and OPNsense.telegraf.output.opentelemetry_enable == '1' %}
[[outputs.opentelemetry]]
{% if helpers.exists('OPNsense.telegraf.output.opentelemetry_server') and OPNsense.telegraf.output.opentelemetry_server != '' %}
service_address = {{ OPNsense.telegraf.output.opentelemetry_server }}
service_address = "{{ OPNsense.telegraf.output.opentelemetry_server }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.opentelemetry_timeout') and OPNsense.telegraf.output.opentelemetry_timeout != '' %}
timeout = "{{ OPNsense.telegraf.output.opentelemetry_timeout }}s"
@ -155,7 +155,11 @@
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.opentelemetry_compression') and OPNsense.telegraf.output.opentelemetry_compression != '' %}
compression = "{{ OPNsense.telegraf.output.opentelemetry_compression }}"
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.opentelemetry_header_name') and OPNsense.telegraf.output.opentelemetry_header_name != '' %}
[outputs.opentelemetry.headers]
"{{ OPNsense.telegraf.output.opentelemetry_header_name }}" = "{{ OPNsense.telegraf.output.opentelemetry_header_value }}"
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.graphite_enable') and OPNsense.telegraf.output.graphite_enable == '1' %}