summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pykhalov <go.wigust@gmail.com>2022-02-06 18:19:44 +0300
committerOleg Pykhalov <go.wigust@gmail.com>2022-02-06 18:22:09 +0300
commitbd7f6c01ac671fcba2efd15fae66c3be18ee0f07 (patch)
treed6e418b4963e35eb07b57cde651e42e3488b6192
parentInitial commit. (diff)
downloadpython-prometheus-ssh-exporter-bd7f6c01ac671fcba2efd15fae66c3be18ee0f07.tar.gz
Add PROMETHEUS_TP_LINK_EXPORTER_LISTEN_ADDRESS environment variable.v1.1.0
-rw-r--r--prometheus_tp_link_exporter/__main__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/prometheus_tp_link_exporter/__main__.py b/prometheus_tp_link_exporter/__main__.py
index d8a0d8a..27472d0 100644
--- a/prometheus_tp_link_exporter/__main__.py
+++ b/prometheus_tp_link_exporter/__main__.py
@@ -9,7 +9,9 @@ import time
host = os.getenv("PROMETHEUS_TP_LINK_EXPORTER_HOST", "")
password = os.getenv("PROMETHEUS_TP_LINK_EXPORTER_PASSWORD", "")
interval = int(os.getenv("PROMETHEUS_TP_LINK_EXPORTER_INTERVAL", "10"))
-listen_port = int(os.getenv("PROMETHEUS_TP_LINK_EXPORTER_LISTEN_PORT", "9101"))
+listen_addresses = os.getenv(
+ "PROMETHEUS_TP_LINK_EXPORTER_LISTEN_ADDRESS", "0.0.0.0:9101"
+)
def ifconfig_devices():
@@ -57,7 +59,9 @@ def process_node_network_transmit_bytes_total():
def main():
"""Entry point."""
- start_http_server(9101)
+ start_http_server(
+ port=int(listen_addresses.split(":")[1]), addr=listen_addresses.split(":")[0]
+ )
while True:
process_node_network_receive_bytes_total()
process_node_network_transmit_bytes_total()