Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP output for Telegraf #4371

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions net-mgmt/telegraf/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PLUGIN_NAME= telegraf
PLUGIN_VERSION= 1.12.11
PLUGIN_REVISION= 2
PLUGIN_VERSION= 1.12.12
PLUGIN_COMMENT= Agent for collecting metrics and data
PLUGIN_DEPENDS= telegraf
PLUGIN_MAINTAINER= m.muenz@gmail.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,50 @@
<type>checkbox</type>
<help>This will skip chain and host verification.</help>
</field>
<field>
<label>HTTP</label>
<type>header</type>
</field>
<field>
<id>output.http_enable</id>
<label>Enable HTTP Output</label>
<type>checkbox</type>
<help>This will enable output via HTTP.</help>
</field>
<field>
<id>output.http_url</id>
<label>HTTP URL</label>
<type>text</type>
<help>Set the URL where metrics should be sent to.</help>
</field>
<field>
<id>output.http_method</id>
<label>HTTP Method</label>
<type>text</type>
<help>Set the HTTP method to use (e.g., POST).</help>
</field>
<field>
<id>output.http_data_format</id>
<label>Data Format</label>
<type>text</type>
<help>Set the data format to use (e.g., json).</help>
</field>
<field>
<id>output.http_insecure_skip_verify</id>
<label>Disable SSL verification</label>
<type>checkbox</type>
<help>This will skip chain and host verification.</help>
</field>
<field>
<id>output.http_headers_content_type</id>
<label>Content-Type Header</label>
<type>text</type>
<help>Set the Content-Type header value.</help>
</field>
<field>
<id>output.http_headers_authorization</id>
<label>Authorization Header</label>
<type>text</type>
<help>Set the Authorization header value.</help>
</field>
</form>
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -247,5 +247,33 @@
<none>none</none>
</OptionValues>
</opentelemetry_compression>
<http_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</http_enable>
<http_url type="TextField">
<default></default>
<Required>N</Required>
</http_url>
<http_method type="TextField">
<default>POST</default>
<Required>N</Required>
</http_method>
<http_data_format type="TextField">
<default>json</default>
<Required>N</Required>
</http_data_format>
<http_insecure_skip_verify type="BooleanField">
<default>0</default>
<Required>N</Required>
</http_insecure_skip_verify>
<http_headers_content_type type="TextField">
<default>application/json</default>
<Required>N</Required>
</http_headers_content_type>
<http_headers_authorization type="TextField">
<default></default>
<Required>N</Required>
</http_headers_authorization>
</items>
</model>
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,31 @@
{% endif %}
{% endif %}

{% if helpers.exists('OPNsense.telegraf.output.http_enable') and OPNsense.telegraf.output.http_enable == '1' %}
[[outputs.http]]
{% if helpers.exists('OPNsense.telegraf.output.http_url') and OPNsense.telegraf.output.http_url != '' %}
url = "{{ OPNsense.telegraf.output.http_url }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.http_method') and OPNsense.telegraf.output.http_method != '' %}
method = "{{ OPNsense.telegraf.output.http_method }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.http_data_format') and OPNsense.telegraf.output.http_data_format != '' %}
data_format = "{{ OPNsense.telegraf.output.http_data_format }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.http_insecure_skip_verify') and OPNsense.telegraf.output.http_insecure_skip_verify == '1' %}
insecure_skip_verify = true
{% else %}
insecure_skip_verify = false
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.http_headers_content_type') and OPNsense.telegraf.output.http_headers_content_type != '' %}
[outputs.http.headers]
Content-Type = "{{ OPNsense.telegraf.output.http_headers_content_type }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.http_headers_authorization') and OPNsense.telegraf.output.http_headers_authorization != '' %}
Authorization = "{{ OPNsense.telegraf.output.http_headers_authorization }}"
{% 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' %}
Expand Down