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 192.168.1.97 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 http://192.168.1.97:8668. 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 192.168.1.97 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:

 

 

Print Friendly
  • Pingback: How to enable missing SNMP on Airport Express and monitoring via LibreNMS | naschenweng.info()

  • 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.