diff options
-rw-r--r-- | docker-compose.yml | 2 | ||||
-rw-r--r-- | switch-snmp/switches.py | 6 |
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 |