net-mgmt/telegraf: add ping input (#522)

This commit is contained in:
Michael 2018-01-27 13:46:43 +01:00 committed by Franco Fichtner
parent 8ab663eb40
commit e56015403c
4 changed files with 30 additions and 2 deletions

View file

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

View file

@ -77,4 +77,18 @@
<type>checkbox</type>
<help>Read network interface metrics.</help>
</field>
<field>
<id>input.ping</id>
<label>Ping</label>
<type>checkbox</type>
<help>Ping Hosts and measure the metrics.</help>
</field>
<field>
<id>input.ping_hosts</id>
<label>Ping Hosts</label>
<type>select_multiple</type>
<style>tokenize</style>
<allownew>true</allownew>
<help>Set the Hosts to ping in a CSV list.</help>
</field>
</form>

View file

@ -55,5 +55,12 @@
<default>0</default>
<Required>N</Required>
</network>
</items>
<ping type="BooleanField">
<default>0</default>
<Required>N</Required>
</ping>
<ping_hosts type="CSVListField">
<Required>N</Required>
</ping_hosts>
</items>
</model>

View file

@ -132,4 +132,11 @@
[[inputs.net]]
{% 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 != '' %}
urls = [{{ "'" + ("','".join(OPNsense.telegraf.input.ping_hosts.split(','))) + "'" }}]
{% endif %}
{% endif %}
{% endif %}