aboutsummaryrefslogtreecommitdiffstats
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
parent595f5c8d41441ac815fac5fa24675f784083b823 (diff)
downloadpower.eda.gay-aed1afd76694cd839947d41c2c20d508b6246ab5.tar.gz
power.eda.gay-aed1afd76694cd839947d41c2c20d508b6246ab5.zip
Removed some port forwards for security
-rw-r--r--docker-compose.yml2
-rw-r--r--switch-snmp/switches.py6
2 files changed, 3 insertions, 5 deletions
diff --git a/docker-compose.yml b/docker-compose.yml
index 1a0309e..fe8fd2e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -31,8 +31,6 @@ services:
build:
context: ./mqtt-client
dockerfile: Dockerfile
- ports:
- - 8000:8000
env_file:
- ./config.env
depends_on:
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