From 4e90aba00bae75280d26f12d3fc9230e305cc9c7 Mon Sep 17 00:00:00 2001 From: Victor Robellini Date: Sat, 4 Apr 2020 18:57:41 -0400 Subject: [PATCH] forgot to add the telegraf_gateways.py script also updated permissions on the plugs to be the same as my pfSense system --- plugins/telegraf_gateways.py | 19 +++++++++++++++++++ plugins/telegraf_netifinfo_plugin.go | 0 plugins/telegraf_temperature.sh | 0 plugins/telegraf_unbound.sh | 0 4 files changed, 19 insertions(+) create mode 100755 plugins/telegraf_gateways.py mode change 100755 => 100644 plugins/telegraf_netifinfo_plugin.go mode change 100644 => 100755 plugins/telegraf_temperature.sh mode change 100644 => 100755 plugins/telegraf_unbound.sh diff --git a/plugins/telegraf_gateways.py b/plugins/telegraf_gateways.py new file mode 100755 index 0000000..a67d034 --- /dev/null +++ b/plugins/telegraf_gateways.py @@ -0,0 +1,19 @@ +#!/usr/local/bin/python2.7 +# Taken From +# https://forum.netgate.com/topic/142093/can-telegraf-package-gather-latency-packet-loss-information/3 + +import glob, os, socket + +DPINGER_SOCK_PATH = "/var/run/" + +os.chdir(DPINGER_SOCK_PATH) + +for sock_name in glob.glob("dpinger*.sock"): + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + sock_path = DPINGER_SOCK_PATH+sock_name + s = sock.connect(sock_path) + line = sock.recv(1024).split('\n', 1)[0] + values = line.split() + print "gateways,gateway_name=" + values[0] + " rtt=" + str(int(values[1])/100.0) + \ + ",rttsd=" + str(int(values[2])/100.0) + ",loss=" + str(int(values[3])) + "i" + sock.close() diff --git a/plugins/telegraf_netifinfo_plugin.go b/plugins/telegraf_netifinfo_plugin.go old mode 100755 new mode 100644 diff --git a/plugins/telegraf_temperature.sh b/plugins/telegraf_temperature.sh old mode 100644 new mode 100755 diff --git a/plugins/telegraf_unbound.sh b/plugins/telegraf_unbound.sh old mode 100644 new mode 100755