Install

apt -y install snmp snmp-mibs-downloader

MIB Download

# apt -y install snmp-mibs-downloader

# tree -F /usr/share/snmp/mibs/
/usr/share/snmp/mibs/
├── iana -> /var/lib/mibs/iana/
├── ietf -> /var/lib/mibs/ietf/
├── NET-SNMP-AGENT-MIB.txt
...
2 directories, 13 files

# tree -F /var/lib/mibs/iana/
/var/lib/mibs/iana/
├── IANAifType-MIB
├── IANA-ITU-ALARM-TC-MIB
...
0 directories, 15 files

# tree -F /var/lib/mibs/ietf/
├── IP-MIB
├── IPV6-FLOW-LABEL-MIB
├── RFC1213-MIB
├── VRRP-MIB
├── WWW-MIB
...
0 directories, 300 files


# mkdir -p ~/.snmp

# git clone --depth=1 https://github.com/librenms/librenms
# mv librenms/mibs ~/.snmp/

# tree -F ~/.snmp/mibs/
$HOME/.snmp/mibs/
├── cisco/
│   ├── CISCO-ENTITY-SENSOR-MIB
│   ├── CISCO-RTTMON-ICMP-MIB
│   ...
│
├── dasan/
│   ├── DASAN-ACCESS-MIB
│   ...
│
├── dell/
│   ├── DELL-NETWORKING-SMI
│   ├── DELL-NETWORKING-SYSLOG-MIB
│   ...
├── 
├── SNMPv2-SMI
├── SNMPv2-SMI-v1
├── SNMPv2-TC
├── SNMPv2-TC-v1
...
338 directories, 4573 files

MIB search path

# O=1.3.6.1.4.1.9.9.513.1.1.1.1.5
# M=~/.snmp/mibs/dell:~/.snmp/mibs/cisco
# snmptranslate -Tz -M +$M -m ALL $O
MIB search path: ~/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:~/.snmp/mibs/dell:~/.snmp/mibs/cisco
CISCO-LWAPP-AP-MIB::cLApName

-M DIR_LIST

Specifies a colon separated list of directories to search for MIBs. This overrides the environment variable MIBDIRS.

중첩된 디렉터리의 MIB을 찾지는 않음

# cat /etc/snmp/snmp.conf | grep mibdirs
mibdirs /usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
# DIR_A, DIR_B 만을 참조
-M DIR_A:DIR_B

# +를 붙이면 기본 경로에 더해서 DIR_A, DIR_B 를 참조함
-M +DIR_A:DIR_B

-m MIB_LIST

Specifies a colon separated list of MIB modules to load for this application. This overrides the environment variable MIBS.
The special keyword ALL is used to specify all modules in all directories when searching for MIB files.

DIR_LIST 안에서 검색 가능한 지정한 MIB 만을 참조, ALL 하면 모든 MIB 참조

-m ALL