Skip to content

Synology Logging using Docker and Telegraf

I got started using these instructions, but they did not work for me out of the box. It seems the default Telegraf Docker Image is missing some SNMP tools / mibs files to function.

Here is how I got it working on my Synology NAS…

Start Default Telegraf Docker Container

We download and start the container with default config, we will later override that config so that we get Synology logging enabled. If we start the container with the “Synology” config already, it will never start because the standard MIBs files are missing and the error stops the container…
So to get started with a working container:

  1. In the Synology user interface, open the Docker Package
  2. Download and launch telegraf:latest Docker image
  3. A Create Container Dialog opens, go to Advanced Settings and apply:
    • Volume -> Add Folder -> mibs folder -> /usr/share/snmp/mibs
    • Network-> Check “Use the same network as Docker Host
    • Complete the creating process to launch the Docker container, it should say “Running” when you switch to “Container” in der Docker Add-on, similar to this:
  4. Log into the running container
    • Login to Synology NAS using SSH, see this how-to if you need help with that
    • Run sudo docker ps
    • your output should show a running telegraf container:
    • We need the name of the running container, in my case “telegraf1”
    • we open a shell inside the container by running
      sudo docker exec -it telegraf1 /bin/bash (where you need to replace “telegraf1” with your container name)
Install the missing MIBs files
  1. In the container shell, we first get ourselves a text editor and enable MIBs loading:
    • apt-get update – update the package manager
    • apt-get upgrade – upgrade all packages
    • apt-get install nano – install an editor, so we can edit files
    • open snmp.conf using nano /etc/snmp/snmp.conf
    • using your cursor, comment out line 4 using an “#” and save the file by pressing ctr+x and entering “Y
  2. Now, we actually add the MIBs
    • When we run snmptranslate -Tp we see that the MIBs files are missing
    • We install them, roughly following this guide but with some extra steps…
    • First, we need to add “non-free” packages to our source list, so we can install the MIBs packages
      • sudo nano /etc/apt/sources.list
      • add “non-free” to all non-commented lines (2, 4, 6 in my case) like so
      • close nano saving the file as before
      • Update package list, like before using apt-get update
    • Finally we can download all MIBs using
      apt-get install snmp-mibs-downloader
    • Now when we run snmptranslate -Tp, we should see a loooong and complicated looking table/tree with lots of entries:
    • We are done “inside” the container, so we can leave with exit
Restart container with Synology Config

Now that we have installed and enabled the missing MIBs, we can start our container with the real “functional” configuration file.

  1. Back in the Synology Docker Add-On, under “Container” stop the running telegraf container
  2. Edit the container and add another Volume
    • docker/telegraf/conf -> /etc/telegraf
  3. Start the container, in the logs the last entry should read
    “Using config file: /etc/telegraf/telegraf.conf”
Other potentially useful sources:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Find my version of “The Hex Game” here.

Being an embedded firmware engineer comes with regular conversions from hex (0xAF) to binary (1010 1111) and vice versa. The conversion rules are simple and there are many good calculators and tools to do the math for you.

I encounter lots of 8 to 32 bit registers in my daily coding life. Often single bits of those registers have to be written or read bitwise and I don’t want to have to either think about the conversion in my head for a longer time or use a converter. I’d much rather have this conversion become somewhat automatic in my head.

To practice quickly converting between 16 bit binary and hexadecimal numbers, I adapter “The Binary Game V2” which itself is a clone of “The Binary Game” by Cisco to display hex numbers rather than decimal numbers. Having never touched Javascript before, this took me longer than anticipated. I shall not touch Javascript again…

As a side note, converting large decimal numbers to hexadecimal is cumbersome by hand, as it involves long divisions and is better left to a computer.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.