Simple Portainer/Docker setup for LibreNMS + Oxidized
This is a basic guide to setting up a LibreNMS instance with Oxidized all inside a single Portainer Stack. The same basic steps would work with Docker Compose if you make a few modifications. This is built off the official docker compose example.
This writeup includes the compose and config files I used, as well as various instructions for things you need to do as you move along.
There are a couple of main things I changed from the official compose example.
- Since we are using Portainer, you need to use
stack.envto reference your .env files. If you are curious about this part, you can read more here. - I used named volumes for easy access to the various configs/files.
- Most importantly for this writeup, I added the oxidized container into the stack.
For Oxidized, the config is changed to use git to store configs locally and to access the librenms container using its containername in the URL.
- Host OS with Docker installed. I used Ubuntu 24.02.
- Portainer installed. You can find instructions here
- Go to the official docker compose example and download the 3 env files (
.env,librenms.env,msmtpd.env)
- Login to Portainer and connect to the local environment, assuming you didn't setup another environment.
- Go into
Stacksand click+ Add stack. - Give it a name.
- Paste the custom compose file into the web editor.
- Click
Load variables from .env fileat the bottom. You will need to do this step three times to load each of the 3 .env files you downloaded in the Prep step above. - Modify the variables as needed. The primary ones you will probably need to update are
LIBRENMS_SNMP_COMMUNITYand all theSMTPvalues. Go ahead and set a goodMYSQL_PASSWORDwhile you are at it. - Click
Deploy the stack
- Connect to the LibreNMS web interface using your browser.
http://[docker host or IP]:3300/- if you changed the port mappings in the compose file, make sure to adjust.
- Complete the initial setup steps. On the validation page, you may see some errors about the Poller. Those cleared up for me after a few minutes and went all green.
- In the top right, click the gear and then
Global Settings. In thePollertab, go set a defaultCommunitiesto be used for SNMP checks. - Go ahead and connect to at least one or two devices so you can test config backups later. How you go about this will depend on a number of factors. For simple testing, you can just add them manually by IP and not worry about auto-discovery.
- Go to
http://[docker host or IP]:3300/api-access/and generate a token. Save this for later.
- In Portainer, stop the
librenms_oxidizedcontainer. There is a config change you will need to make before things will work. - Find the mount point for your oxidized configs. You can find this in Portainer by going to
Volumesand looking forlibrenms_oxidized-config. TheMount pointis what you are looking for. In my case it was/var/lib/docker/volumes/librenms_oxidized-config/_data. - SSH (or console) to your docker host.
- Edit the oxidized config file:
sudo nano /var/lib/docker/volumes/librenms_oxidized-config/_data/config- Adjust as needed based on what you found in step 2 above.
- You can start with this customized config file
- Make sure to edit the usernames and passwords. There is a default at the top, and in the
modelssection there is a template for doing a login for each model type if needed. - On the last line, you will need to put the API token you got in the Initial Setup step earlier.
- In the
sourcesection there is a URL. You will not need to edit that since both containers are in the same stack. It will be accessing it using the container name and the internal container port.
- Make sure to edit the usernames and passwords. There is a default at the top, and in the
- Go into Portainer and start the
librenms_oxidizedcontainer again.
- Use a browser to access LibreNMS web interface:
http://[docker host or IP]:3300/ - Go to the gear in the top right, and go to
Global Settings. - Go to the
Externaltab. - Enter the URL as
http://librenms_oxidized:8888. Keep in mind, this is the internal container name and port, so unless you modified the container name, this should work. - Enable the config versioning option and the return of groups.
- Variable mapping - here you may need to add some mapping so that the OS that LibreNMS passes along will match a model that Oxidized is familiar with. For instance, I had to add
arubaos-cx>aoscxfor my CX switches. Once things are connected, if your Oxidized logs show errors similar to{:name=>"[IP of switch]", :model=>"[LibreNMS OS value]", :group=>nil} raised Oxidized::ModelNotFound with message...then you will need to add mapping for that model.- If you do need mapping, set the
Sourcedropdown toos, set the dropdown on the left toMatchand enter the LibreNMS OS (it's what showed up in the error above). Then theTargetshould be set toosand inReplacement, enter a value that exists in Oxidized. You can find the list of supported models here.
- If you do need mapping, set the
- Now turn on the top option to
Enable Oxidized Support.
You can monitor the Oxidized logs from Portainer to make sure it is able to connect to the switches. Once the initial backups complete, you should be able to view them from within the device page.