net-mgmt/telegraf: Add graphite and graylog output (#487)

This commit is contained in:
Michael 2018-01-15 14:20:21 +01:00 committed by Franco Fichtner
parent 51f5c73d1d
commit 4304f2d4be
4 changed files with 82 additions and 2 deletions

View file

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

View file

@ -1,7 +1,7 @@
<form>
<field>
<id>output.influx_enable</id>
<label>Enable Influx</label>
<label>Enable Influx Output</label>
<type>checkbox</type>
<help>This will enable InfluxDB as output. Format is without square brackets, just like http://192.168.0.1:8086.</help>
</field>
@ -35,4 +35,40 @@
<type>text</type>
<help>Set the password for authentication.</help>
</field>
<field>
<id>output.graphite_enable</id>
<label>Enable Graphite Output</label>
<type>checkbox</type>
<help>This will enable Graphite as output. Format is without square brackets, just like localhost:2003.</help>
</field>
<field>
<id>output.graphite_server</id>
<label>Graphite Server</label>
<type>text</type>
<help>Set the IP and port where metrics shoud be sent to.</help>
</field>
<field>
<id>output.graphite_prefix</id>
<label>Graphite Prefix</label>
<type>text</type>
<help>Set an optional prefix to the metrics.</help>
</field>
<field>
<id>output.graphite_template</id>
<label>Graphite Template</label>
<type>text</type>
<help>Use a specific output template. For usage see https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md</help>
</field>
<field>
<id>output.graylog_enable</id>
<label>Enable Graylog Output</label>
<type>checkbox</type>
<help>This will enable Graylog as output. Format is without square brackets, just like localhost:12201.</help>
</field>
<field>
<id>output.graylog_server</id>
<label>Graylog Server</label>
<type>text</type>
<help>Set the IP and port where metrics shoud be sent to.</help>
</field>
</form>

View file

@ -27,5 +27,27 @@
<default></default>
<Required>N</Required>
</influx_password>
<graphite_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</graphite_enable>
<graphite_server type="TextField">
<default></default>
<Required>Y</Required>
</graphite_server>
<graphite_prefix type="TextField">
<Required>N</Required>
</graphite_prefix>
<graphite_template type="TextField">
<Required>N</Required>
</graphite_template>
<graylog_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</graylog_enable>
<graylog_server type="TextField">
<default></default>
<Required>Y</Required>
</graylog_server>
</items>
</model>

View file

@ -57,6 +57,28 @@
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.graphite_enable') and OPNsense.telegraf.output.graphite_enable == '1' %}
[[outputs.graphite]]
{% if helpers.exists('OPNsense.telegraf.output.graphite_server') and OPNsense.telegraf.output.graphite_server != '' %}
servers = ["{{ OPNsense.telegraf.output.graphite_server }}"]
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.graphite_prefix') and OPNsense.telegraf.output.graphite_prefix != '' %}
prefix = "{{ OPNsense.telegraf.output.graphite_prefix }}"
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.graphite_template') and OPNsense.telegraf.output.graphite_template != '' %}
template = "{{ OPNsense.telegraf.output.graphite_template }}"
{% endif %}
timeout = 2
insecure_skip_verify = true
{% endif %}
{% if helpers.exists('OPNsense.telegraf.output.graylog_enable') and OPNsense.telegraf.output.graylog_enable == '1' %}
[[outputs.graylog]]
{% if helpers.exists('OPNsense.telegraf.output.graylog_server') and OPNsense.telegraf.output.graylog_server != '' %}
servers = ["{{ OPNsense.telegraf.output.graylog_server }}"]
{% 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' %}