net-mgmt/telegraf: add prometheus output and pf input (#834)

This commit is contained in:
Michael
2018-09-10 16:31:39 +02:00
committed by Franco Fichtner
parent 818da34c75
commit 53df78a5f2
6 changed files with 70 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= telegraf
PLUGIN_VERSION= 1.5.1
PLUGIN_VERSION= 1.6.0
PLUGIN_COMMENT= Agent for collecting metrics and data
PLUGIN_DEPENDS= telegraf
PLUGIN_MAINTAINER= m.muenz@gmail.com
@@ -79,6 +79,12 @@
<type>checkbox</type>
<help>Read network interface metrics.</help>
</field>
<field>
<id>input.pf</id>
<label>PF</label>
<type>checkbox</type>
<help>Read PF values via pfctl.</help>
</field>
<field>
<id>input.ping</id>
<label>Ping</label>
@@ -101,4 +101,28 @@
<type>text</type>
<help>Set the index name.</help>
</field>
<field>
<id>output.prometheus_enable</id>
<label>Enable Prometheus Output</label>
<type>checkbox</type>
<help>This will enable Prometheus as output.</help>
</field>
<field>
<id>output.prometheus_listen</id>
<label>Prometheus Listen Port</label>
<type>text</type>
<help>Port to listen on.</help>
</field>
<field>
<id>output.prometheus_exclude</id>
<label>Prometheus Collector Exclude</label>
<type>text</type>
<help>Collectors to enable, valid entries are "gocollector" and "process". If unset, both are enabled.</help>
</field>
<field>
<id>output.prometheus_stringaslabel</id>
<label>Prometheus String as Label</label>
<type>checkbox</type>
<help>Send string metrics as Prometheus labels.</help>
</field>
</form>
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/telegraf/input</mount>
<description>Telegraf inputs configuration</description>
<version>1.0.0</version>
<version>1.0.1</version>
<items>
<cpu type="BooleanField">
<default>1</default>
@@ -55,6 +55,10 @@
<default>0</default>
<Required>N</Required>
</network>
<pf type="BooleanField">
<default>0</default>
<Required>N</Required>
</network>
<ping type="BooleanField">
<default>0</default>
<Required>N</Required>
@@ -66,5 +66,20 @@
<default>telegraf-%Y.%m.%d</default>
<Required>N</Required>
</elastic_indexname>
<prometheus_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</prometheus_enable>
<prometheus_listen type="PortField">
<default>9273</default>
<Required>N</Required>
</prometheus_listen>
<prometheus_exclude type="CSVListField">
<Required>N</Required>
</prometheus_exclude>
<prometheus_stringaslabel type="BooleanField">
<default>1</default>
<Required>N</Required>
</prometheus_stringaslabel>
</items>
</model>
@@ -96,6 +96,21 @@
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.prometheus_enable') and OPNsense.telegraf.output.prometheus_enable == '1' %}
[[outputs.prometheus_client]]
{% if helpers.exists('OPNsense.telegraf.output.prometheus_listen') and OPNsense.telegraf.output.prometheus_listen != '' %}
listen = ":{{ OPNsense.telegraf.output.prometheus_listen }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.prometheus_exclude') and OPNsense.telegraf.output.prometheus_exclude != '' %}
collectors_exclude = [{{ "'" + ("','".join(OPNsense.telegraf.output.prometheus_exclude.split(','))) + "'" }}]
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.prometheus_stringaslabel') and OPNsense.telegraf.output.prometheus_stringaslabel == '1' %}
string_as_label = true
{% else %}
string_as_label = false
{% 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' %}
@@ -149,6 +164,10 @@
[[inputs.net]]
{% endif %}
{% if helpers.exists('OPNsense.telegraf.input.pf') and OPNsense.telegraf.input.pf == '1' %}
[[inputs.pf]]
{% endif %}
{% if helpers.exists('OPNsense.telegraf.input.ping') and OPNsense.telegraf.input.ping == '1' %}
[[inputs.ping]]
{% if helpers.exists('OPNsense.telegraf.input.ping_hosts') and OPNsense.telegraf.input.ping_hosts != '' %}