I am trying to read snmp data from my QNAP NAS.
To do this I downloaded the MIB from my NAS and mounted it in my telegraf docker container.
I also altered the snmp.conf
to add a comment to the mibs :
line.
My problem is that all the NAS-MIB:: OIDs not working - but the QTS-MIB:: OIDs do.
According to snmpexplorer both object identifier included in the MIB file provided by QNAP.
Here is my Dockerfile, building the telegraf image:
ARG TELEGRAF_VERSION
FROM telegraf:${TELEGRAF_VERSION}
RUN echo "deb http://http.us.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/sources.list
RUN apt -y update && apt -y upgrade
RUN apt install -y unzip wget snmp-mibs-downloader
RUN wget https://github.com/hdecarne-github/fritzbox-telegraf-plugin/releases/download/v0.4.0/fritzbox-linux-amd64-0.4.0.zip
RUN unzip fritzbox-linux-amd64-0.4.0.zip -d /usr/local/bin/telegraf/
RUN sed -i 's/mibs :/#mibs :/g' /etc/snmp/snmp.conf
This is the telegraf part in my docker-compose.yml
telegraf:
build:
context: telegraf/
args:
TELEGRAF_VERSION: latest
hostname: "telegraf"
container_name: telegraf
depends_on:
- influxdb
volumes:
- ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
- ./telegraf/fritzbox.conf:/etc/telegraf/fritzbox.conf
- ./telegraf/telegraf.d/:/etc/telegraf/telegraf.d/
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./telegraf/snmp/mibs/qnap.mib:/usr/share/snmp/mibs/NAS.mib
environment:
-USER: "telegraf"
-INFLUX_PASSWORD: "ChangeMe!"
networks:
- influx
When doing some troubleshooting I can successfully grab QTS-MIB::enclosureName.1
but nothing from the NAS-MIB::
context
root@telegraf:/# snmpwalk -u USER -a SHA -A ChangeMe! -x DES -X ChangeMe! -l authPriv 192.168.30.2 NAS-MIB::cpuTable
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (NAS-MIB): At line 1 in (none)
NAS-MIB::cpuTable: Unknown Object Identifier
root@telegraf:/# snmpwalk -u USER -a SHA -A ChangeMe! -x DES -X ChangeMe! -l authPriv 192.168.30.2 QTS-MIB::cpuTable
QTS-MIB::cpuTable: Unknown Object Identifier
root@telegraf:/# snmpwalk -u USER -a SHA -A ChangeMe! -x DES -X ChangeMe! -l authPriv 192.168.30.2 NAS-MIB::enclosureName.1
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (NAS-MIB): At line 1 in (none)
NAS-MIB::enclosureName.1: Unknown Object Identifier
root@telegraf:/# snmpwalk -u USER -a SHA -A ChangeMe! -x DES -X ChangeMe! -l authPriv 192.168.30.2 QTS-MIB::enclosureName.1
QTS-MIB::enclosureName.1 = STRING: "li2nas1"
root@telegraf:/# snmptable -u USER -a SHA -A ChangeMe! -x DES -X ChangeMe! -l authPriv 192.168.30.2 NAS-MIB::cpuTable
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (NAS-MIB): At line 1 in (none)
NAS-MIB::cpuTable: Unknown Object Identifier
root@telegraf:/# snmptable -u USER -a SHA -A ChangeMe! -x DES -X ChangeMe! -l authPriv 192.168.30.2 QTS-MIB::cpuTable
QTS-MIB::cpuTable: Unknown Object Identifier
root@telegraf:/#
Any ideas what am I doing wrong?