我想在计算机上试用 snmp trap,但需要 MIB 列表(我猜)。那么在 Ubuntu 12.04 系统上哪里可以找到它?
答案1
首先,正如解释的那样这里,在你的 Ubuntu 12.04 计算机上设置 SNMP:
安装 SNMP 包:
$ sudo apt-get install snmpd $ sudo apt-get install snmp
使用以下命令下载 MIB 文件:
$ sudo apt-get install snmp-mibs-downloader (...) Downloading documents and extracting MIB files. This will take some minutes. In case this process fails, it can always be repeated later by executing /usr/bin/download-mibs again. RFC1155-SMI: 119 lines. RFC1213-MIB: 2613 lines. NOTE: SMUX: ignored. SMUX-MIB: 158 lines. CLNS-MIB: 1294 lines. (...)
mibs:
像/etc/snmp/snmp.conf
这样注释掉:# As the snmp packages come without MIB files due to license reasons, loading # of MIBs is disabled by default. If you added the MIBs you can reenable # loaging them by commenting out the following line. #mibs:
重新启动 snmpd:
$ sudo /etc/init.d/snmpd restart
现在您可以查询本地 SNMP 守护程序:
$ snmpwalk -mALL -v1 -cpublic localhost system 2>/dev/null
SNMPv2-MIB::sysDescr.0 = STRING: Linux ubuntu 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:57 UTC 2013 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-TC::linux
DISMAN-EXPRESSION-MIB::sysUpTimeInstance = Timeticks: (54813) 0:09:08.13
SNMPv2-MIB::sysContact.0 = STRING: Me <[email protected]>
SNMPv2-MIB::sysName.0 = STRING: ubuntu
(...)
系统上面snmpwalk
的是对象标识符 (OID),即标识可通过 SNMP 查询的变量的唯一名称。OID 按层次结构组织,在本例中snmpwalk
显示了在子树下找到的所有变量系统。
有关可用于测试 SNMP 的 Linux OID 列表,请访问http://www.debianadmin.com/linux-snmp-oids-for-cpumemory-and-disk-statistics.html。