snmptranslate - translate SNMP OID values into a more useful form
/usr/sfw/bin/snmptranslate [-D token...] [-h] [-m miblist] [-M dirlist] [-T transopts] [common options] OID [OID...]
snmptranslate is an application that translates one or more SNMP object identifier values from their symbolic (text) forms into their numerical forms or vice-versa.
OID is either a numeric or text object identifier.
The following options are supported:
-D token[,...]
Turn on debugging output for the specified token(s). Use ALL for extremely verbose output.
-h
Display a brief usage message and then exit.
-m miblist
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. Every file whose name does not begin with "." is parsed as if it were a MIB file.
-M dirlist
Specifies a colon-separated list of directories to search for MIBs. This overrides the environment variable MIBDIRS.
-T transopts
Provides control over the translation of the OID values. The following transopts are available:
-Td Display full details of the specified OID.
-Tp Display a graphical tree, rooted at the specified OID.
-Ta Dump the loaded MIB in a trivial form.
-Tl Dump a labeled form of all objects.
-To Dump a numeric form of all objects.
-Ts Dump a symbolic form of all objects.
-Tt Dump a tree form of the loaded MIBs (mostly useful for debugging).
-V Display version information for the application and then exit.
-w width Specifies the width of -Tp and -Td output. The default is very large.
In addition to the preceding options, snmptranslate takes the OID input (-I), MIB parsing (-M) and OID output (-O) options described in the INPUT OPTIONS, MIB PARSING OPTIONS and OUTPUT OPTIONS sections of snmpcmd(1M).
Example 1: Expanding sysDescr
The following command translates sysDescr to a more qualified form:
% snmptranslate -On -IR sysDescr .1.3.6.1.2.1.1.1
The following command does further translation of sysDescr:
% snmptranslate -Onf -IR sysDescr .iso.org.dod.internet.mgmt.mib-2.system.sysDescr
Again, the following command does further translates sysDescr:
% snmptranslate -Td -IR -OS system.sysDescr SNMPv2-MIB::sysDescr sysDescr OBJECT-TYPE -- FROM SNMPv2-MIB -- TEXTUAL CONVENTION DisplayString SYNTAX OCTET STRING (0..255) DISPLAY-HINT "255a" MAX-ACCESS read-only STATUS current DESCRIPTION "A textual description of the entity. This value should include the full name and version identification of the system's hardware type, software operating-system, and networking software." ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) system(1) 1 }
Example 2: Displaying a Tree
The following command displays the tree shown below:
% snmptranslate -Tp -IR -OS system +--system(1) | +-- -R-- String sysDescr(1) | Textual Convention: DisplayString | Size: 0..255 +-- -R-- ObjID sysObjectID(2) +-- -R-- TimeTicks sysUpTime(3) | | | +-- sysUpTimeInstance(0) | +-- -RW- String sysContact(4) | Textual Convention: DisplayString | Size: 0..255 +-- -RW- String sysName(5) | Textual Convention: DisplayString | Size: 0..255 +-- -RW- String sysLocation(6) | Textual Convention: DisplayString | Size: 0..255 +-- -R-- INTEGER sysServices(7) | Range: 0..127 +-- -R-- TimeTicks sysORLastChange(8) | Textual Convention: TimeStamp | +--sysORTable(9) | +--sysOREntry(1) | Index: sysORIndex(1) | +-- ---- INTEGER sysORIndex(1) | Range: 1..2147483647 +-- -R-- ObjID sysORID(2) +-- -R-- String sysORDescr(3) | Textual Convention: DisplayString | Size: 0..255 +-- -R-- TimeTicks sysORUpTime(4) Textual Convention: TimeStamp
Example 3: Dumping MIB Contents
The commands shown below produce the dumps that follow.
% snmptranslate -Ta | head dump DEFINITIONS ::= BEGIN org ::= { iso 3 } dod ::= { org 6 } internet ::= { dod 1 } directory ::= { internet 1 } mgmt ::= { internet 2 } experimental ::= { internet 3 } private ::= { internet 4 } security ::= { internet 5 } snmpV2 ::= { internet 6 }
Here is use of the -Tl option:
% snmptranslate -Tl | head .iso(1).org(3) .iso(1).org(3).dod(6) .iso(1).org(3).dod(6).internet(1) .iso(1).org(3).dod(6).internet(1).directory(1) .iso(1).org(3).dod(6).internet(1).mgmt(2) .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1) .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1) .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysDescr(1) .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysObjectID(2) .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysUpTime(3)
Here is the use of the -To option:
% snmptranslate -To | head .1.3 .1.3.6 .1.3.6.1 .1.3.6.1.1 .1.3.6.1.2 .1.3.6.1.2.1 .1.3.6.1.2.1.1 .1.3.6.1.2.1.1.1 .1.3.6.1.2.1.1.2 .1.3.6.1.2.1.1.3
Here is the use of the -Ts option:
% snmptranslate -Ts | head .iso.org .iso.org.dod .iso.org.dod.internet .iso.org.dod.internet.directory .iso.org.dod.internet.mgmt .iso.org.dod.internet.mgmt.mib-2 .iso.org.dod.internet.mgmt.mib-2.system .iso.org.dod.internet.mgmt.mib-2.system.sysDescr .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID .iso.org.dod.internet.mgmt.mib-2.system.sysUpTime
Here is the use of the -Tt option:
% snmptranslate -Tt | head org(3) type=0 dod(6) type=0 internet(1) type=0 directory(1) type=0 mgmt(2) type=0 mib-2(1) type=0 system(1) type=0 sysDescr(1) type=2 tc=4 hint=255a sysObjectID(2) type=1 sysUpTime(3) type=8
0 Successful completion.
1 A usage syntax error. A usage message is displayed. Also used for matching object errors, after which an error message is displayed.
2 An error occurred while executing the command. An error message is displayed.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Availability | SUNWsmcmd |
Interface Stability | External |
snmpcmd(1M), snmp_variables(4), attributes(5)
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |