snmptable コマンドは、SNMP テーブルの内容を取り出して表形式で表示します。つまり、一度に表 1 行分を取り出すため、最終的な出力結果は元の表と似たものになります。これは、表の内容を一度に 1 列分表示する snmpwalk コマンドと対照的です。
以下は、snmptable コマンドの例です。
% snmptable SNMP_agent sysORTable SNMP table: SNMPv2-MIB::sysORTable sysORID sysORDescr sysORUpTime IF-MIB::ifMIB The MIB module to 0:0:00:00.01 describe generic objects SNMPv2-MIB::snmpMIB The MIB module for SNMPv2 0:0:00:00.02 for network interface entities. TCP-MIB::tcpMIB The MIB module for 0:0:00:00.02 sub-layers. managing TCP UDP implementations. UDP-MIB::udpMIB The MIB module for managing 0:0:00:00.02 RFC1213-MIB::ip The MIB module for managing 0:0:00:00.02 implementations. SNMP-VIEW-BASED-ACM- View-based Access Control 0:0:00:00.02 SNMP-FRAMEWORK-MIB:: The SNMP Management 0:0:00:00.14 IP and ICMP implementations. MIB::vacmBasicGroup Model for SNMP. snmpFrameworkMIB Architecture MIB. Compliance SNMP-MPD-MIB::snmp The MIB for Message 0:0:00:00.14 MPDCompliance Processing and Dispatching. SNMP-USER-BASED-SM- The management information 0:0:00:00.14 MIB::usmMIBCompliance definitions for the SNMP User-based Security Model.
snmptable コマンドの例では、-Ci および -Cb オプションが使用されています。以下は、snmptable コマンドに -Ci オプションを使用した例です:
% snmptable -Ci SNMP_agent sunPlatFanTable SNMP table: SUN-PLATFORM-MIB::sunPlatFanTable index sunPlatFanClass 10 fan 11 fan 17 fan 23 fan 29 fan 30 fan 36 fan 42 fan
以下は、snmptable コマンドに -Ci オプションを使用しない例です。index の列が表示されていません:
% snmptable SNMP_agent sunPlatFanTable SNMP table: SUN-PLATFORM-MIB::sunPlatFanTable sunPlatFanClass fan fan fan fan fan
以下は、snmptable コマンドに -Ci および -Cb オプションを使用した例です。出力は簡潔化されています。
% snmptable -Ci -Cb SNMP_agent entPhysicalTable index Descr VendorType ContainedIn SNMP table: ENTITY ?SNMPv2- 0 chassis -MIB::entPhysical SMI:zeroDotZero 1 Table
以下は、同じ snmptable コマンドに -Ci オプションを使用し、-Cb オプションは使用しない例です。やはり出力は簡潔化されています。MIB オブジェクトの名前が見出しごとに繰り返されています。
% snmptable -Ci SNMP_agent entPhysicalTable index entPhysicalDescr entPhysical entPhysical VendorType ContainedIn SNMP table: ENTITY ?SNMPv2- 0 chassis 1 -MIB::entPhysical SMI:zeroDotZero
もう 1 つ、snmptable コマンドに -Ci および -Cb オプションの両方を使用した例を示します。MIB オブジェクトは見出しごとに繰り返されていません。
% snmptable -Cb -Ci SNMP_agent ilomCtrlAlertsTable SNMP table: SUN-ILOM-CONTROL-MIB::ilomCtrlAlertsTable in- Sever- Type Destin- Destin- SNMPVer- SNMP-Comm- Email Email dex ity ation- ation- sion unityOr- Event Event 1 criti- email ? 0.0.0.0 v1 public none none IP Email Username Class Type cal 2-15 dis- ipmi- 0.0.0.0 ? v1 public ? ? Filter Filter able pet
このように、 snmptable コマンドに -Cb オプションを指定すると、表出力が読みやすいものになります。
以下は、SNMP プロトコル version 3 を使用した snmptable コマンドの例です。
% snmptable -Cb -Ci -mALL -v3 -aMD5 -utestuser -Apassword -lauthNoPriv SNMP_agent:port sunPlatPowerSupplyTable SNMP table: SUN-PLATFORM-MIB::sunPlatPowerSupplyTable index sunPlatPowerSupplyClass 90 powerSupply 92 powerSupply 96 powerSupply
次の snmptable コマンドは空の表を返します。
% snmptable -Cb -Ci SNMP_agent sunPlatBatteryTable SUN-PLATFORM-MIB::sunPlatBatteryTable: No entries