Monitoring your Ubiquiti home-network with a Docker LibreNMS and SNMP

My Ubiquiti network gear is an awesome “prosumer” device and it supports a number of enterprise features for gadgeteers to use. Over the years I tried various methods of monitoring devices and network throughput – either via RRD, SmokePing or custom scripts.

With my Ubiquiti gear installed and the lack of any network issues at home for weeks, I managed to find a new monitoring project in the form of LibreNMS which supports a large number of devices and graphs via standard SNMP:

Want to monitor your printer, Synology NAS or switch – well you can do now. My HP printer will now report status of toner and I can configure an email alert to remind me to purchase new ink once a threshold is reached:

The Synology reports a vast array of information and allows me to monitor and alert on storage, CPU utilisation and other vitals:

Installing LibreNMS

This is the easiest part – I use Docker running on my Synology DS1010+ and creating the Docker container is simple:

First I create a MySQL database which runs on my Synology:

The next step is to create the Docker container for LibreNMS. In my case the is the IP of my Synology where Docker runs. I also use MariaDB on my Synology which is needed for LibreNMS to store recorded data. LibreNMS can be accessed via For all my Docker configurations I create separate directories on the Synology and mount those as volumes via the -v switch.

Before you can access LibreNMS, you need to create a LibreNMS admin user:

The next step is to adjust SNMP configuration (this is typically not necessary, but with the config below I restrict explorable network ranges and the community strings required to explore SNMP devices.

Connect to your Docker image:

Edit the LibreNMS config via vim /opt/librenms/config.php and add the following:

Enabling SNMP on Ubiquiti

I prefer configuring my Ubiquiti kit via the config.gateway.json on my Unifi Cloud Key – this is relatively simple by placing the file into the /srv/unifi/data/sites/default/ directory on my Cloud Key:

The above will require some adjustments to change the SNMP server IP (in my case is my Synology) as well as the community string. In the above configuration file you will also notice a few more tuning options, which you can leave or remove:

  • MSS-Clamping: In my case I noticed MTU fragmentation with my ISP and I then ensured that MTU size is fixed to avoid packet fragementation and re-transmission
  • UPNP: We are a house full of gamers and multiple consoles and UPNP is a necessity to have a good online gaming experience

With the above changes, LibreNMS will start to discover devices and monitor vitals of all your peripherals on your network (I went to configure SNMP everywhere I could). I found the quickest way to get all the devices discovered is to manually initiate a discovery on LibreNMS:

Using WatchTower to keep your Docker images up-to-date

Maintainers of Docker images often tweak and adjust the images with fixes and enhancements. I previously used to just destroy the current container and re-create it with the latest image. Until I found WatchTower which is an application that will monitor your running Docker containers and watch for changes to the images that those containers were originally started from. If Watchtower detects that an image has changed, it will automatically restart the container using the new image.

Installation is simple:


🍺 Pay it forward: If any of my content helped you in any way, then follow me on Twitter or send me some coins:

Affiliates: Binance (#altcoins), Coinbase (buy/sell ETH/BTC, get 10$), (get 10% off), TradingView (trend reports) or old-school PayPal.

Print Friendly, PDF & Email
  • Pingback: How to enable missing SNMP on Airport Express and monitoring via LibreNMS |

  • Amdc Bot

    Hi, I’m wondering if its possible to have librenms grab sensor details of macOS temperature, fan speeds, etc?

    • I have not done it, but macOS has a built-in snmpd daemon which you would need to just configure and the macOS launchd would just manage the start of it. LibreNMS would auto-discover your macOS.

      • Amdc Bot

        Thanks Gerd, I have snmp configured for my macOS, however, sadly, there’s not much information that librenms is gathering from it, sensors seem to be entirely missing.

  • Patrick

    Hello Gerd,
    I’m new to all of this stuff so sorry for the basic question…
    All went well, got the docker image installed an running. I only can’t access it.
    Running the command below gives me an “MySQL Error: Connection refused”
    “docker exec librenms php /opt/librenms/adduser.php admin admin 10 [email protected]
    Any idea what could be wrong?

    • This sounds to me that the Docker image can not access the MySQL DB. In my case I have a Synology which runs Docker. The MySQL DB runs natively on Synology and Docker connects to it via it’s external IP

    • Josh

      Your MySql config most likely isn’t set up to allow connections from another IP. Mine had the same error because my config had the “bind-address” set to I changed that to the IP of the machine running MySql and that fixed the issue for me.

  • Erik

    Hello Gerd,

    A quick question. I am running MariaDB 10 which listens on port 3307 in stead of 3306. Does an environment variable exist where I can specify the database port, like “-e DB_PORT = 3307”?

    • Erik

      I have to read before I ask. Sorry. I found the answer on your Docker repo under chapterEnvironment config.


  • Banzi

    I’m missing the following command to prepare the database:

    docker exec librenms sh -c “cd /opt/librenms && php /opt/librenms/build-base.php”

    • Josh

      Yep, this should be added to this write-up. It gets run after the docker is started and before the admin user is added. Otherwise nothing will work properly (since the database tables aren’t added).
      That threw me for a loop for a bit longer than I’d care to admit.

      Otherwise, thanks for this info. Definitely helpful!

  • Banzi

    Just checking… I don’t have a snmp-scan.php file… I had to use the following command:
    Then it runs for a while
    Then it runs for a while