Self-Hosting LibreNMS with Docker Compose

What Is LibreNMS?

LibreNMS is a fully-featured network monitoring system that auto-discovers devices on your network via SNMP, CDP, LLDP, and other protocols. It monitors bandwidth, CPU, memory, disk, environmental sensors, and more across 1,500+ device types out of the box — switches, routers, firewalls, servers, printers, UPS units. It’s the self-hosted alternative to paid monitoring tools like PRTG, SolarWinds, and Datadog’s infrastructure monitoring.

Official site: librenms.org

Prerequisites

  • A Linux server (Ubuntu 22.04+ recommended)
  • Docker and Docker Compose installed (guide)
  • 2 GB of free RAM (4 GB+ for 50+ devices)
  • 20 GB of free disk space
  • Network access to devices you want to monitor (SNMP)
  • A domain name (optional, for remote access)

Docker Compose Configuration

LibreNMS runs as a multi-container stack: the web interface, a dispatcher for SNMP polling, a database, and Redis for caching.

Create a project directory:

mkdir -p ~/librenms && cd ~/librenms

Create docker-compose.yml:

services:
  librenms:
    image: librenms/librenms:26.2.0
    container_name: librenms
    ports:
      - "8000:8000"
    volumes:
      - librenms-data:/data
    environment:
      TZ: UTC
      PUID: "1000"
      PGID: "1000"
      DB_HOST: mariadb
      DB_PORT: "3306"
      DB_NAME: librenms
      DB_USER: librenms
      DB_PASSWORD: change-this-password         # CHANGE THIS
      DB_TIMEOUT: "60"
      REDIS_HOST: redis
      REDIS_PORT: "6379"
      REDIS_DB: "0"
      MEMORY_LIMIT: 256M
      UPLOAD_MAX_SIZE: 16M
    depends_on:
      mariadb:
        condition: service_healthy
      redis:
        condition: service_started
    restart: unless-stopped

  dispatcher:
    image: librenms/librenms:26.2.0
    container_name: librenms-dispatcher
    volumes:
      - librenms-data:/data
    environment:
      TZ: UTC
      PUID: "1000"
      PGID: "1000"
      DB_HOST: mariadb
      DB_PORT: "3306"
      DB_NAME: librenms
      DB_USER: librenms
      DB_PASSWORD: change-this-password         # MUST MATCH above
      DB_TIMEOUT: "60"
      REDIS_HOST: redis
      REDIS_PORT: "6379"
      REDIS_DB: "0"
      SIDECAR_DISPATCHER: "1"
      DISPATCHER_NODE_ID: dispatcher-1
    depends_on:
      mariadb:
        condition: service_healthy
      redis:
        condition: service_started
    restart: unless-stopped

  snmptrapd:
    image: librenms/librenms:26.2.0
    container_name: librenms-snmptrapd
    ports:
      - "162:162/udp"
    volumes:
      - librenms-data:/data
    environment:
      TZ: UTC
      PUID: "1000"
      PGID: "1000"
      DB_HOST: mariadb
      DB_PORT: "3306"
      DB_NAME: librenms
      DB_USER: librenms
      DB_PASSWORD: change-this-password         # MUST MATCH above
      REDIS_HOST: redis
      SIDECAR_SNMPTRAPD: "1"
    depends_on:
      - librenms
    restart: unless-stopped

  mariadb:
    image: mariadb:10.11
    container_name: librenms-db
    environment:
      MYSQL_ROOT_PASSWORD: change-root-password  # CHANGE THIS
      MYSQL_DATABASE: librenms
      MYSQL_USER: librenms
      MYSQL_PASSWORD: change-this-password       # MUST MATCH above
    volumes:
      - librenms-db:/var/lib/mysql
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    container_name: librenms-redis
    volumes:
      - librenms-redis:/data
    restart: unless-stopped

volumes:
  librenms-data:
  librenms-db:
  librenms-redis:

Start the stack:

docker compose up -d

Wait 1–2 minutes for database initialization and schema creation.

Initial Setup

  1. Open http://your-server-ip:8000 in your browser
  2. Create an admin account through the web UI
  3. Navigate to Devices → Add Device
  4. Enter your first device’s hostname or IP
  5. Set the SNMP community string (default is usually public — change this on your devices)
  6. LibreNMS will poll the device and auto-discover its interfaces, sensors, and metrics

Adding Devices via CLI

# Add a device with SNMP v2c
docker compose exec librenms lnms device:add 192.168.1.1 --v2c --community public

# Add with SNMP v3
docker compose exec librenms lnms device:add 192.168.1.1 --v3 --authlevel authPriv --authname user --authpass pass --cryptopass pass

Key Capabilities

FeatureDetails
AutodiscoverySNMP, CDP, LLDP, OSPF, BGP, ARP-table scanning
Device support1,500+ device types (Cisco, Juniper, Ubiquiti, Arista, Dell, HP, Linux, Windows)
MetricsBandwidth, CPU, memory, disk, temperature, humidity, power draw
Alerting40+ transports: Slack, Discord, PagerDuty, Telegram, email, webhooks
DashboardsCustomizable with real-time graphs
APIFull REST API for automation
MapsAutomatic network topology maps
WeathermapVisual bandwidth utilization maps
SyslogCentralized syslog collection and alerting
SNMP trapsReceive and process device traps

Configuration

SNMP Settings

Configure your network devices to allow SNMP polling from the LibreNMS server. At minimum:

  • Enable SNMP v2c or v3 on each device
  • Set a community string (v2c) or authentication credentials (v3)
  • Allow SNMP traffic from the LibreNMS server IP

Alert Rules

LibreNMS includes default alert rules. Customize them at Alerts → Alert Rules. Common rules:

  • Device down (no SNMP response)
  • Interface utilization above threshold
  • CPU/memory above threshold
  • BGP session down
  • Environmental sensor out of range

Alert Transports

Configure where alerts go at Alerts → Alert Transports. Popular options:

  • Email (requires SMTP setup)
  • Slack webhook
  • Discord webhook
  • Telegram bot
  • PagerDuty

Reverse Proxy

LibreNMS serves on port 8000. Place it behind a reverse proxy for HTTPS:

server {
    listen 443 ssl;
    server_name librenms.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

See the Reverse Proxy Setup guide for more options.

Backup

Back up these volumes:

  • librenms-data — application data, RRD graphs, plugins
  • librenms-db — MariaDB database (device configs, alert history)
docker compose stop
docker run --rm -v librenms-data:/data -v $(pwd):/backup alpine tar czf /backup/librenms-data.tar.gz -C /data .
docker run --rm -v librenms-db:/data -v $(pwd):/backup alpine tar czf /backup/librenms-db.tar.gz -C /data .
docker compose up -d

See the Backup Strategy guide.

Troubleshooting

Devices not being polled

Symptom: Devices show as added but graphs stay empty.

Fix: The dispatcher sidecar must be running. Check:

docker compose logs dispatcher

Look for “poller” messages. If the dispatcher isn’t running, polling doesn’t happen — the web container alone won’t poll devices.

Permission errors on /data volume

Symptom: Container fails to start with permission denied errors.

Fix: The /data volume ownership must match PUID:PGID values. Fix with:

docker compose exec librenms chown -R 1000:1000 /data

SNMP timeouts

Symptom: “SNMP transport: no response” when adding devices.

Fix: Verify SNMP is enabled on the target device. Test from the LibreNMS container:

docker compose exec librenms snmpget -v2c -c public 192.168.1.1 sysDescr.0

If this times out, the issue is network connectivity or SNMP configuration on the device, not LibreNMS.

Resource Requirements

ScaleDevicesRAMCPUDisk
Homelab1–202 GB2 cores20 GB
Small business20–1004 GB2–4 cores40 GB
Medium100–5008–16 GB4–8 cores100 GB
Large500+16–32 GB8+ cores200+ GB

RRD graph storage is the main disk consumer. For 100 devices with 50 ports each, expect ~10 GB of RRD data after a month.

Verdict

LibreNMS is the most capable self-hosted network monitoring tool available. If you have managed switches, routers, or any SNMP-enabled infrastructure, LibreNMS gives you visibility that’s on par with commercial tools costing thousands per year. It’s overkill for monitoring a few Docker containers — use Uptime Kuma or Beszel for that. But for genuine network infrastructure monitoring, nothing self-hosted comes close.

FAQ

How does LibreNMS compare to Zabbix?

Both are enterprise-grade monitoring tools, but they approach monitoring differently. LibreNMS excels at SNMP-based network monitoring with autodiscovery — add a switch and it automatically finds all ports, metrics, and neighbors. Zabbix is more versatile with agent-based monitoring, template-driven configuration, and stronger at monitoring servers and applications. For network infrastructure (switches, routers, firewalls), LibreNMS is simpler to set up. For server and application monitoring, Zabbix is more capable.

Do I need SNMP on every device I want to monitor?

For full monitoring (bandwidth, CPU, memory, interface details), yes — SNMP is how LibreNMS collects metrics. However, LibreNMS can also monitor devices via ICMP ping (up/down status only), syslog collection, and API polling for some devices. SNMP v2c is the minimum for useful monitoring; SNMP v3 adds encryption and is recommended for production.

Can LibreNMS monitor Docker containers?

Not natively. LibreNMS is designed for network infrastructure, not container orchestration. For Docker container monitoring, use Uptime Kuma (health checks), Beszel (resource monitoring), or Prometheus with cAdvisor. LibreNMS can monitor the Docker host itself via SNMP.

How many devices can LibreNMS handle?

Thousands. The architecture scales with hardware. A homelab setup (2 GB RAM, 2 cores) handles 20-50 devices comfortably. A dedicated server (16 GB RAM, 8 cores) manages 500+ devices. For larger deployments, distribute polling across multiple dispatcher nodes. RRD graph storage is the main disk constraint at scale.

Does LibreNMS support alerting?

Yes, with 40+ notification transports: email, Slack, Discord, Telegram, PagerDuty, OpsGenie, webhooks, and more. Default alert rules cover common scenarios (device down, high CPU, interface errors). Create custom rules based on any collected metric. Alert escalation and acknowledgment workflows are built in.

Is LibreNMS free for commercial use?

Yes. LibreNMS is licensed under GPLv3 with no commercial restrictions, no per-device fees, and no feature tiers. The entire feature set is available in the open-source version. This makes it a direct replacement for paid tools like PRTG or SolarWinds for organizations that can self-host.

Comments