在哪里可以找到我的计算机 (Ubuntu 12.04) 的 MIB 列表?

Ale*_*lex 6 linux snmp ubuntu ubuntu-12.04

我想在我的计算机上使用 snmp 陷阱,但需要 MIB 列表(我猜)。那么我在哪里可以在 Ubuntu 12.04 系统上找到它呢?

jau*_*ume 12

首先,说明这里,建立SNMP你的Ubuntu 12.04的计算机上:

  1. 安装 SNMP 软件包:

    $ sudo apt-get install snmpd
    $ sudo apt-get install snmp
    
    Run Code Online (Sandbox Code Playgroud)
  2. 使用以下命令下载 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.
    (...)
    
    Run Code Online (Sandbox Code Playgroud)
  3. 注释掉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:
    
    Run Code Online (Sandbox Code Playgroud)
  4. 重启snmpd:

    $ sudo /etc/init.d/snmpd restart
    
    Run Code Online (Sandbox Code Playgroud)

现在您可以查询本地 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 <me@example.org>
SNMPv2-MIB::sysName.0 = STRING: ubuntu
(...)
Run Code Online (Sandbox Code Playgroud)

系统snmpwalk上述是一个对象标识符(OID),即,一个唯一的名称,它标识可经由SNMP查询的变量。OID 是按层次组织的,在这种情况下snmpwalk显示在system下的子树中找到的所有变量。

要获取可用于测试 SNMP 的 Linux OID 列表,请访问http://www.debianadmin.com/linux-snmp-oids-for-cpumemory-and-disk-statistics.html