plaintextpackets/netprobe_lite

Issues with launching netprobe-presentation

Opened this issue · 1 comments

Hiya,
I'm having issues with running netprobe-presentation after migrating the stack to a new machine, running it on an external grafana source:

  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 264, in connect
    sock = self.retry.call_with_retry(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 51, in call_with_retry
    raise error
  File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 46, in call_with_retry
    return do()
           ^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 265, in <lambda>
    lambda: self._connect(), lambda error: self.disconnect(error)
            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 627, in _connect
    raise err
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 615, in _connect
    sock.connect(socket_address)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/netprobe_lite/presentation.py", line 141, in <module>
    REGISTRY.register(CustomCollector())
  File "/usr/local/lib/python3.11/site-packages/prometheus_client/registry.py", line 40, in register
    names = self._get_names(collector)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prometheus_client/registry.py", line 80, in _get_names
    for metric in desc_func():
  File "/netprobe_lite/presentation.py", line 34, in collect
    results_netprobe = cache.redis_read('netprobe') # Get the latest results from Redis
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/netprobe_lite/helpers/redis_helper.py", line 27, in redis_read
    results = self.r.get(key) # Get the latest results from Redis for a given key
              ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/commands/core.py", line 1829, in get
    return self.execute_command("GET", name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 533, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 1086, in get_connection
    connection.connect()
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 268, in connect
    raise TimeoutError("Timeout connecting to server")
redis.exceptions.TimeoutError: Timeout connecting to server
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 264, in connect
    sock = self.retry.call_with_retry(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 51, in call_with_retry
    raise error
  File "/usr/local/lib/python3.11/site-packages/redis/retry.py", line 46, in call_with_retry
    return do()
           ^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 265, in <lambda>
    lambda: self._connect(), lambda error: self.disconnect(error)
            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 627, in _connect
    raise err
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 615, in _connect
    sock.connect(socket_address)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/netprobe_lite/presentation.py", line 141, in <module>
    REGISTRY.register(CustomCollector())
  File "/usr/local/lib/python3.11/site-packages/prometheus_client/registry.py", line 40, in register
    names = self._get_names(collector)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prometheus_client/registry.py", line 80, in _get_names
    for metric in desc_func():
  File "/netprobe_lite/presentation.py", line 34, in collect
    results_netprobe = cache.redis_read('netprobe') # Get the latest results from Redis
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/netprobe_lite/helpers/redis_helper.py", line 27, in redis_read
    results = self.r.get(key) # Get the latest results from Redis for a given key
              ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/commands/core.py", line 1829, in get
    return self.execute_command("GET", name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 533, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 1086, in get_connection
    connection.connect()
  File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 268, in connect
    raise TimeoutError("Timeout connecting to server")
redis.exceptions.TimeoutError: Timeout connecting to server

I can see there's some mention of connecting to servers, but i've checked my fw and can confirm that traffic is being passed through without issue. Attached below is my compose.yml

name: netprobe

networks:
  netprobe-net:

services:
  redis:
    restart: always
    container_name: netprobe-redis
    image: "redis:latest"
    volumes:
      - ./config/redis/redis.conf:/etc/redis/redis.conf
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4

  netprobe:
    restart: always
    container_name: netprobe-probe
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - .:/netprobe_lite
    environment:
      MODULE: "NETPROBE"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4

  speedtest:
    restart: always
    container_name: netprobe-speedtest
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - .:/netprobe_lite
    environment:
      MODULE: "SPEEDTEST"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4

  presentation:
    restart: always
    container_name: netprobe-presentation
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - .:/netprobe_lite
    environment:
      MODULE: "PRESENTATION"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4

  prometheus:
    restart: always
    container_name: netprobe-prometheus
    image: "prom/prometheus"
    user: "1000:1000"
    ports:
      - '9090:9090'
    volumes:
      - ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
      - /home/sshondz/netprobe_lite/prometheus_data:/prometheus  # Persistent local storage for Prometheus data
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4


volumes:
  prometheus_data:

I'm a bit lost with python, so any help here is appreciated!
Kind regards,

after some tinkering, i've seemingly gotten everything to work despite the netprobe presentation errors. As far as I'm concerned, you can mark this issue as resolved ✨