aboutsummaryrefslogtreecommitdiffstats
path: root/switch-snmp
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2026-06-20 14:01:36 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2026-06-20 14:01:36 +0100
commitdcd272e1277c81d8c7d1b79897560659f4af9002 (patch)
tree2403413960c35c3805335954623a64364e3151c4 /switch-snmp
parent79bc0eb0f08638c8ded80b04e4d0ae6f18cbe417 (diff)
downloadpower.eda.gay-master.tar.gz
power.eda.gay-master.zip
Changed QOS shitHEADmaster
Diffstat (limited to 'switch-snmp')
-rw-r--r--switch-snmp/snmpOmada.py2
-rw-r--r--switch-snmp/switches.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/switch-snmp/snmpOmada.py b/switch-snmp/snmpOmada.py
index d3b183c..cf7994e 100644
--- a/switch-snmp/snmpOmada.py
+++ b/switch-snmp/snmpOmada.py
@@ -70,6 +70,8 @@ def readings_to_points(readings, switch_host):
for p, group_df in df.groupby(["port", "port_name"]):
port, port_name = p
fields = dict(zip(group_df['endpoint'], group_df['reading']))
+ if 'tpPoeClass' in fields.keys():
+ fields['tpPoeClass'] = str(fields['tpPoeClass'])
points.append({
"measurement": "switch_status",
diff --git a/switch-snmp/switches.py b/switch-snmp/switches.py
index 06d7b5b..20523ac 100644
--- a/switch-snmp/switches.py
+++ b/switch-snmp/switches.py
@@ -4,6 +4,7 @@ import prometheus_client
import snmpOmada
import mikrotik
import json
+import time
import os
from influxdb_client import InfluxDBClient, Point, WritePrecision
@@ -18,10 +19,10 @@ def append(points):
influxc.ping()
for measurement in points:
+ # print(json.dumps({**measurement["tags"], **measurement["fields"]}, indent = 4, cls = NumpyEncoder))
mqttc.publish(
"tele/SwitchSNMP/%s/%s/SENSOR" % (measurement["tags"]["switch_host"], str(measurement["tags"]["port"])),
- json.dumps({**measurement["tags"], **measurement["fields"]}, cls = NumpyEncoder),
- qos = 1
+ json.dumps({**measurement["tags"], **measurement["fields"]}, cls = NumpyEncoder)
)
for field in measurement["fields"].keys():
try: