¿ MIBs folder/volume in telegraf´s docker-compose.yml file?

Hello team:
I am a beginner in the use of Telegraf so I ask your forgiveness with the following question if it so basic for this forum :o)

I am about to install telegraf via a docker-compose.yml specification.

I want to create a directory and add in it some MIB files that might be needed by Telegraf.

The question I have is: ¿ How does telegraf “know” from which mapped volume to pull these MIB files when needed?
I would have expected this “mibs” directory to be either a well known path that I have to specify or otherwise referenced within the telegraf.conf file, but I was not able to find a document that explains the procedure to carry out.
Your help will be greatly appreciated
Best regards.


After some reading, it seems to be that Telegraf´s SNMP plugin uses the snmptranslate() command to perform lookups from the MIB.
It also seems that unless the MIBDIRS environment variable is modified, snmptranslate() will search in the /usr/local/share/snmp/mibs directory for MIB files. So adding such a path in the volumes section of the docker-compose.yml file would solve the request.

¿ Am I pointed in the right direction?

So adding such a path in the volumes section of the docker-compose.yml file would solve the request.

This sounds correct - did this resolve your issue?

Hello Josh, nice to meet you.

I talked to a friend of mine last week. He handed me over a bunch of lines to add to my docker-compose.yml file. Look below to the line related to my doubt: he is using “/usr/share/mibs/site” on the docker side instead of “/usr/local/share/snmp/mibs”.
So I loaded my mibs files on the ${PWD}/telegraf/mibs directory and everything worked fine! I am little bit confused, since I would have expected this suggestion from him not to be right.
Next week I will stop my service, replace that line with “/usr/local/share/snmp/mibs”, and see whether Telegraf is still able to locate the mib files.

image: telegraf:latest
- ${PWD}/telegraf/mibs:/usr/share/mibs/site
- ${PWD}/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
- ${PWD}/telegraf/conf.d:/etc/telegraf/telegraf.d
- /var/run/utmp:/var/run/utmp
- /proc:/proc
- /sys:/sys
- /var/run/docker.sock:/var/run/docker.sock

ok, there may be multiple directories that the library looks at, so either might be correct. There is no harm in continuing to use what is working :slight_smile:

Sure! It it works do not touch it :grinning:

But I fear that in a future upgrade I could find that it stops working. So if a more known source directory works as well, then I would stick to the mainstream.
Thanks a lot for your kind answer.
Best regards