MiguelNdeCarvalho/speedtest-exporter

Cannot read from socket

Opened this issue · 1 comments

I'm trying deploy the exporter via Docker but I have the following error:
image

This is my docker-compose with differents exporters with prometheus and grafana and the other ones are working fine except speedtest:

version: "3"
services:
  grafana:
    container_name: monitoring-grafana
    image: grafana/grafana:latest
    hostname: rpi-grafana
    restart: unless-stopped
    user: "472"
    networks:
      - internal
    ports:
      - "3000:3000"
    env_file:
      - ./grafana/.env
    volumes:
      # /!\ To be modified depending on your needs /!\
      - ./grafana/data:/var/lib/grafana
      - ./grafana/provisioning:/etc/grafana/provisioning
    depends_on:
      - prometheus

  cadvisor:
    container_name: monitoring-cadvisor
    image: gcr.io/cadvisor/cadvisor:v0.47.0
    hostname: rpi-cadvisor
    restart: unless-stopped
    privileged: true
    networks:
      - internal
    expose:
      - 8080
    devices:
      - /dev/kmsg
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
      - /dev/disk/:/dev/disk:ro
      - /etc/machine-id:/etc/machine-id:ro

  node-exporter:
    container_name: monitoring-node-exporter
    image: prom/node-exporter:latest
    hostname: rpi-exporter
    restart: unless-stopped
    networks:
      - internal
    expose:
      - 9100
    command:
      - --path.procfs=/host/proc
      - --path.sysfs=/host/sys
      - --path.rootfs=/host
      - --collector.filesystem.ignored-mount-points
      - ^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
      - /:/host:ro,rslave

  prometheus:
    container_name: monitoring-prometheus
    image: prom/prometheus:latest
    hostname: rpi-prometheus
    restart: unless-stopped
    user: "nobody"
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
    networks:
      - internal
    expose:
      - 9090
    ports:
      - "9090:9090"
    volumes:
      # /!\ To be modified depending on your needs /!\
      - ./prometheus/data:/prometheus
      - ./prometheus:/etc/prometheus/
    depends_on:
      - cadvisor
      - node-exporter
      - speedtest-exporter
    links:
      - cadvisor:cadvisor
      - node-exporter:node-exporter
      - speedtest-exporter:speedtest-exporter

  speedtest-exporter:
    image: miguelndecarvalho/speedtest-exporter
    container_name: speedtest-exporter
    environment:
      - SPEEDTEST_PORT:9798
      - SPEEDTEST_SERVER:14543
    hostname: rpi-speedtest
    networks:
      - internal
    expose:
      - 9798
    ports:
      - 9798:9798
    restart: unless-stopped

networks:
  internal:
    driver: bridge

I had a similar issue when using billimek/prometheus-speedtest-exporter the other day, I've opened an issue there.:

[2024-04-03 12:06:27.330] [warning] Receive error: 11 (Resource temporarily unavailable)
[2024-04-03 12:06:27.331] [warning] Receive error: 11 (Resource temporarily unavailable)
[2024-04-03 12:06:27.332] [warning] Loaded latency: Hello handshake failed with the server: [0] Cannot read from socket:
[2024-04-03 12:06:27.332] [info] Connection 3 failed. Added connection and continuing test.
[2024-04-03 12:06:27.334] [info] Connection 4 failed. Added connection and continuing test.
[2024-04-03 12:06:27.335] [error] Test failed to complete: Cannot read from socket:

I've tested with network_mode: host and this seems to solve the issue, although some non-fatal warnings about Cannot read from uninitialized socket can still be seen in the runs.

It seems like an issue with ookla-speedtest being run inside a docker container with bridge networking, but I am still failing to understand why this might be.