diff options
| author | jwansek <eddie.atten.ea29@gmail.com> | 2026-06-20 14:01:36 +0100 |
|---|---|---|
| committer | jwansek <eddie.atten.ea29@gmail.com> | 2026-06-20 14:01:36 +0100 |
| commit | dcd272e1277c81d8c7d1b79897560659f4af9002 (patch) | |
| tree | 2403413960c35c3805335954623a64364e3151c4 /switch-snmp/switches.py | |
| parent | 79bc0eb0f08638c8ded80b04e4d0ae6f18cbe417 (diff) | |
| download | power.eda.gay-dcd272e1277c81d8c7d1b79897560659f4af9002.tar.gz power.eda.gay-dcd272e1277c81d8c7d1b79897560659f4af9002.zip | |
Diffstat (limited to 'switch-snmp/switches.py')
| -rw-r--r-- | switch-snmp/switches.py | 5 |
1 files changed, 3 insertions, 2 deletions
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: |
