VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1[2] ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 21:33:45 01/28/07 Sun
Author: Anandan
Subject: snmptranslate
In reply to: Anandan 's message, "Net Snmp Commands" on 22:59:39 01/15/07 Mon

We have seen that snmpwalk of NET SNMP used to go through MIB. snmptranslate is another tool used to present a MIB in a human-readable form.snmptranslate can be used in a number of different ways. First, it can be used to translate betwen the text and numeric form of an object. For example
$snmptranslate .1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr
$snmptranslate .1.3.6.1.2.1.system.sysDescr.0
SNMPv2-MIB::sysDescr.0
$snmptranslate -On .1.3.6.1.2.1.system.sysDescr.0
.1.3.6.1.2.1.1.1.0

It is not sufficient to give
$snmptranslate system.sysDescr.0
system.sysDescr.0: Unknown Object Identifier (Sub-id not found: (top) -> system)
To get around this, use -IR option.(This is usually the default for most NET Snmp commands)
$snmptranslate -IR system.sysDescr.0
SNMPv2-MIB::sysDescr.0
$snmptranslate -IR sysDescr.0
SNMPv2-MIB::sysDescr.0

One can use regular expressions as well:
$snmptranslate -On -Ib 'sys.*ime'
system.sysUpTime
Notice the use of single quotes.(This option can return a few surpriss at times as well.)

To get extended information use -Td option:
$snmptranslate -Td 1.3.6.1.2.1.system.sysContact
SNMPv2-MIB::sysContact
sysContact OBJECT-TYPE
-- FROM SNMPv2-MIB, RFC1213-MIB
-- TEXTUAL CONVENTION DisplayString
SYNTAX OCTET STRING (0..255)
DISPLAY-HINT "255a"
MAX-ACCESS read-write
STATUS current
DESCRIPTION "The textual identification of the contact person for
this managed node, together with information on how
to contact this person. If no contact information is
known, the value is the zero-length string."
::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) system(1) 4 }
This is basically what we saw in the MIB but ina little more detail.

We can use snmptranslate to generate a tree representation for subtrees by using the -Tp option:
$snmptranslate -Tp 1.3.6.1.2.1.system
+--system(1)
|
+-- -R-- String sysDescr(1)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- ObjID sysObjectID(2)
+-- -R-- TimeTicks sysUpTime(3)
+-- -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
|
+-- ---- 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

Don't get surprised to see the output for
$snmptranslate -Tp

To print all objects in labeled form (-Tl),
numeric form (-To),
symbolic form (-Tt).

If you have trouble using snmptranlate, the first thing to check is whether your MIBs are correctly loaded.

[ Next Thread | Previous Thread | Next Message | Previous Message ]

[ Contact Forum Admin ]


Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.