Skip to content

Promethues exporter for sagecom router based on python-sagemcom-api

Notifications You must be signed in to change notification settings

Unknowlars/Sagecom-exporter

Repository files navigation

Sagemcom Exporter

A Prometheus exporter for Sagemcom routers (often ISP-provided) to monitor:

  • DHCP leases (connected/disconnected clients, MAC address, hostname, status)
  • Router status (software version, build, model, uptime)
  • WiFi channel info
  • Port mapping (port forwarding rules, internal/external ports, protocol, status)
  • Speedtest metrics (download/upload speeds)
  • Ping metrics

Built on python-sagemcom-api.
Tested on Sagemcom Fast 3890v3, but may work on other models supported by python-sagemcom-api.


Quick Start

  1. Clone this repository (or use the docker-compose.yml).
version: "3"
services:
  sagemcom_prometheus_exporter:
    image: ghcr.io/unknowlars/sagecom-exporter:latest
    container_name: sagemcom_prometheus_exporter
    environment:
      ROUTER_HOST: 192.168.0.1
      ROUTER_USERNAME: admin
      ROUTER_PASSWORD: Password
      COLLECTION_INTERVAL: 300
      SERVER_PORT: 8000
    ports:
      - 7000:8000
    volumes:
      - /etc/localtime:/etc/localtime:ro
  1. Update environment variables in docker-compose.yml:
   environment:
     ROUTER_HOST: 192.168.0.1     # IP or hostname of your Sagemcom router
     ROUTER_USERNAME: admin       # Admin username
     ROUTER_PASSWORD: Password    # Admin password
     COLLECTION_INTERVAL: 300     # Frequency (in seconds) to collect metrics
     SERVER_PORT: 8000           # Port on which the exporter listens
  1. Start the exporter: docker compose up -d

  2. Configure Prometheus to scrape http://<host>:7000/metrics.

  3. (Optional) Import the provided Grafana dashboard to visualize metrics.


Usage

Building Locally

git clone (https://github.com/Unknowlars/Sagecom-exporter.git) 
cd sagemcom-exporter
docker build -t sagemcom-exporter .  
docker run -d \
  --name sagecom_prometheus_exporter \
  -e ROUTER_HOST=192.168.0.1 \
  -e ROUTER_USERNAME=admin \
  -e ROUTER_PASSWORD=Password \
  -e COLLECTION_INTERVAL=300 \
  -e SERVER_PORT=8000 \
  -p 7000:8000 \
  -v /etc/localtime:/etc/localtime:ro \
  -v /etc/timezone:/etc/timezone:ro \
  sagecom-exporter:latest


Grafana Dashboard

Downlaod & Import Sagecom-1736606124800.json and select your promethues datasource

Screenshot 1
Screenshot 2
Screenshot 3


Security Considerations

  • Because this exporter connects to your router with admin credentials, ensure that it is not publicly exposed.
  • Restrict access to the exporter’s port or run it behind a secure network.

Credits


About

Promethues exporter for sagecom router based on python-sagemcom-api

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages