aboutsummaryrefslogtreecommitdiffstats
path: root/switch-snmp
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2025-05-28 22:38:41 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2025-05-28 22:38:41 +0100
commitaed1afd76694cd839947d41c2c20d508b6246ab5 (patch)
tree684c11763730bcb9418f7554199d276a0b2a71c9 /switch-snmp
parent595f5c8d41441ac815fac5fa24675f784083b823 (diff)
downloadpower.eda.gay-aed1afd76694cd839947d41c2c20d508b6246ab5.tar.gz
power.eda.gay-aed1afd76694cd839947d41c2c20d508b6246ab5.zip
Removed some port forwards for security
Diffstat (limited to 'switch-snmp')
-rw-r--r--switch-snmp/switches.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/switch-snmp/switches.py b/switch-snmp/switches.py
index bede120..1bc43c2 100644
--- a/switch-snmp/switches.py
+++ b/switch-snmp/switches.py
@@ -28,6 +28,7 @@ def append(points):
port_name = measurement["tags"]["port_name"],
host = measurement["tags"]["switch_host"]
).set(float(measurement["fields"][field]))
+ prometheus_client.push_to_gateway("%s:9091" % PUSHGATEWAY_HOST, job = "switchSNMP", registry = registry)
write_api = influxc.write_api(write_options = SYNCHRONOUS)
write_api.write(
@@ -52,11 +53,10 @@ if __name__ == "__main__":
switch_power = prometheus_client.Gauge(
"switch_power",
"POE switch power usage metrics from Omada and Mikrotik switches, using Omada SNMP names",
- labelnames = ["field", "type", "port", "port_name", "host"]
+ labelnames = ["field", "type", "port", "port_name", "host"],
+ registry = registry
)
points = snmpOmada.get_points() + mikrotik.get_points()
mikrotik.print_points(points)
append(points)
-
- prometheus_client.push_to_gateway("%s:9091" % PUSHGATEWAY_HOST, job = "switchSNMP", registry = registry) \ No newline at end of file