forgot to add the telegraf_gateways.py script

also updated permissions on the plugs to be the same as my pfSense system
This commit is contained in:
Victor Robellini 2020-04-04 18:57:41 -04:00
parent f3a4aaa86d
commit 4e90aba00b
4 changed files with 19 additions and 0 deletions

19
plugins/telegraf_gateways.py Executable file
View File

@ -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()

0
plugins/telegraf_netifinfo_plugin.go Executable file → Normal file
View File

0
plugins/telegraf_temperature.sh Normal file → Executable file
View File

0
plugins/telegraf_unbound.sh Normal file → Executable file
View File