Discussion:
I am struggling to understand the snmptranslate command
Jeff Silverman
2006-07-11 05:58:16 UTC
Permalink
I picked ipSystemStatsInDiscards as my test OID because my family says
that my home LAN is performing poorly. So I thought this would be a
golden opportunity to learn something about SNMP. Alas, I'm not doing a
very good job starting out.

[***@black ~]$ snmptranslate -Ib ipSystemStatsInDiscards
IP-MIB::ipSystemStatsInDiscards
[***@black ~]$ snmptranslate -Of -Ib ipSystemStatsInDiscards
.iso.org.dod.internet.mgmt.mib-2.ip.ipTrafficStats.ipSystemStatsTable.ipSystemStatsEntry.ipSystemStatsInDiscards
[***@black ~]$ snmptranslate -On IP-MIB::ipSystemStatsInDiscards
.1.3.6.1.2.1.4.31.1.1.17
[***@black ~]$ snmptranslate .1.3.6.1.2.1.4.31.1.1.17
IP-MIB::ipSystemStatsInDiscards

So far, so good, I guess. I'm not sure why it uses IP-MIB:: but since
the translation is bijective, I guess there's a good reason. However,
the following doesn't work and I don't understand why not.

[***@black ~]$ snmptranslate
.iso.org.dod.internet.mgmt.mib-2.ip.ipTrafficStats.ipSystemStatsTable.ipSystemStatsEntry.ipSystemStatsInDiscards
No log handling enabled - turning on stderr logging
.iso.org.dod.internet.mgmt.mib-2.ip.ipTrafficStats.ipSystemStatsTable.ipSystemStatsEntry.ipSystemStatsInDiscards:
Unknown Object Identifier (Sub-id not found: iso -> iso)

Is this problem the reason why snmpget doens't work?

[***@black ~]$ snmpget -v 2c -Le -c puBlIc localhost
.1.3.6.1.2.1.4.31.1.1.17
IP-MIB::ipSystemStatsInDiscards = No Such Object available on this agent
at this OID
[***@black ~]$

Here are some other things I have tried which still don't work the way I
guess I expect them to.

[***@black ~]$ snmpget -v 2c -c public localhost system.sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
[***@black ~]$ snmpget -v 2c -c public localhost SNMPv2-MIB::sysDescr
SNMPv2-MIB::sysDescr = No Such Instance currently exists at this OID
[***@black ~]$ snmptranslate -Of -Ib sysDescr
.iso.org.dod.internet.mgmt.mib-2.system.sysDescr
[***@black ~]$ snmptranslate -On -Ib sysDescr
.1.3.6.1.2.1.1.1
[***@black ~]$ snmpget -v 2c -c public localhost SNMPv2-MIB::sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
[***@black ~]$ snmpget -v 2c -c public localhost
.iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
[***@black ~]$ snmptranslate -Td
.iso.org.dod.internet.mgmt.mib-2.ip.ipInDiscards.0
No log handling enabled - turning on stderr logging
.iso.org.dod.internet.mgmt.mib-2.ip.ipInDiscards.0: Unknown Object
Identifier (Sub-id not found: iso -> iso)
[***@black
~]$

[***@black ~]$ snmpget -v 2c -c public localhost .1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr = No Such Instance currently exists at this OID
[***@black ~]$ snmpget -v 2c -c public localhost .1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
[***@black ~]$

Hopefully, I am running into a simple stupid problem with a simple
answer. Can somebody please tell me what that problem is?

[***@black ~]$ snmptranslate -V
NET-SNMP version: 5.3
[***@black ~]$ cat /etc/redhat-release
Fedora Core release 5 (Bordeaux)
[***@black ~]$


Thank you


Jeff Silverman
Dave Shield
2006-07-11 09:53:29 UTC
Permalink
Post by Jeff Silverman
Is this problem the reason why snmpget doens't work?
.1.3.6.1.2.1.4.31.1.1.17
IP-MIB::ipSystemStatsInDiscards = No Such Object available on this agent
at this OID
No.
The 'snmpget' command is interpreting the numeric OID, and translating it
into
the textual equivalent quite happily. The problem lies elsewhere (see
below).


Here are some other things I have tried which still don't work the way I
Post by Jeff Silverman
guess I expect them to.
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
SNMPv2-MIB::sysDescr = No Such Instance currently exists at this OID
That's because you've omitted the instance identifier(s).
A value is always associated with an *instance* of a MIB object,
not with the (abstract) object itself. If you're familiar with
object-oriented
programming, think of a MIB object as similar to a class - you need to
declare one or more instances of that class before you can use it.

(And yes, I know that's not strictly true - e.g. "static" fields/methods!)

This is also the source of your earlier problem - you omitted the
instance subidentifier(s) for ipSystemStatsInDiscard


Try using "snmpgetnext" or "snmpwalk" instead of "snmpget" with the discard
stats object. That will retrieve the first (or all) instance of this
object.

Dave
Dave Shield
2006-07-12 08:56:14 UTC
Permalink
[ First - *please* don't mail me privately, without copying
any responses to the mailing list. I don't have the time
or inclination to offer private, unpaid, SNMP consultancy.
Keep discussions to the list, where others can both learn
and offer advice. Thanks. ]
I found the snmpbrowser, but it's linked against a library that no
exists, apparently. So I created a symlink to libnetsnmp.so.10.0.1
and that made it worse.
The "snmpbrowser" package isn't our code, so we can't really comment.
You'll need to talk to RedHat or the author about that.
I tried snmpwalk but it only partly works.
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (20) 0:00:00.20
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (857648) 2:22:56.48
HOST-RESOURCES-MIB::hrSystemUptime.0 = No more variables left in this
MIB View
Please see the FAQ entry:
I can see the system group, but nothing else. Why?


This is definitely a problem with the access control settings - nothing
to do with
snmptranslate.
May I conclude that because I'm getting something back from the snmpd
that my snmp client is working properly and that my problem is on the
snmpd (the agent) side?
Yes. Got it in one.
One of the things I put in there was some testing for disk space, CPU
load, and the size of a file, but I don't see those in the tree
produced by snmpwalk.
Because the access control settings don't allow access to them.
I looked at the snmpd.conf file and I found and changed some things,
which made things worse.
"Changed some things" isn't particularly helpful in knowing what's going
wrong.
If you're reporting problems, it's worth being as exact as possible.
The more we
have to guess, the more we won't bother :-)
At the end of the file is the following section. I commented out
the 6 directives and now, not only does the public community name no
longer work, but the cvv_ro name I created also fails.
rocommunity cvv_ro 192.168.2.0/24
rwcommunity cvv_rw 192.168.2.0/24
Start as simple as possible.
Create an snmpd.conf file containing *just*

rocommunity cvv_test

and run the agent using that.
Can you see the system group ("snmpgetnext -v 2c -c cvv_test
{agent_host} system") ?
Can you see other groups ("snmpgetnext -v 2c -c cvv_test
{agent_host} ip") ?


If that works (and *only* if it works), add the 192.168.2.0/24
limitation, and try again.

Dave
Jeff Silverman
2006-07-14 06:52:28 UTC
Permalink
Post by Dave Shield
Post by Jeff Silverman
SNMPv2-MIB::sysDescr.0 = STRING: Linux black 2.6.15-1.2054_FC5 #1 Tue
Mar 14 15:48:33 EST 2006 i686
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (20) 0:00:00.20
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (857648) 2:22:56.48
HOST-RESOURCES-MIB::hrSystemUptime.0 = No more variables left in this
MIB View
I can see the system group, but nothing else. Why?
http://net-snmp.sourceforge.net/docs/FAQ.html#I_can_see_the_system_group__but_nothing_else___Why_
Post by Dave Shield
This is definitely a problem with the access control settings -
nothing to do with
snmptranslate.
Post by Jeff Silverman
I looked at the snmpd.conf file and I found and changed some things,
which made things worse.
"Changed some things" isn't particularly helpful in knowing what's
going wrong.
If you're reporting problems, it's worth being as exact as possible.
The more we
have to guess, the more we won't bother :-)
Quite right - I apologize. I changed the rocommunity and rwcommunity
strings to verify that the snmpd was looking at the right snmpd.conf
file, and it is.
Post by Dave Shield
Start as simple as possible.
Create an snmpd.conf file containing *just*
rocommunity cvv_test
and run the agent using that.
Can you see the system group ("snmpgetnext -v 2c -c cvv_test
{agent_host} system") ?
Yes.
Post by Dave Shield
Can you see other groups ("snmpgetnext -v 2c -c cvv_test
{agent_host} ip") ?
Yes. In fact, I can do the following which is 'way cool:
[***@black ~]$ snmpwalk -v 2c -c cvv_test localhost | wc -l
2055
[***@black ~]$

There is so much interesting stuff, for example, there appears to be a
dump of the RPM database in there:
HOST-RESOURCES-MIB::hrSWInstalledName.697 = STRING: "rpm-build-4.1.1-1.8x"
...
HOST-RESOURCES-MIB::hrSWInstalledDate.697 = STRING: 2005-7-6,23:54:20.0,-7:0

so I can do my software audits using SNMP. Whoo hoo!
Post by Dave Shield
If that works (and *only* if it works), add the 192.168.2.0/24
limitation, and try again.
Dave
I owe you a beer, at least. Somehow I will get one to you.

Jeff

Thomas Anders
2006-07-11 15:37:06 UTC
Permalink
Post by Jeff Silverman
.iso.org.dod.internet.mgmt.mib-2.ip.ipTrafficStats.ipSystemStatsTable.ipSystemStatsEntry.ipSystemStatsInDiscards
No log handling enabled - turning on stderr logging
Unknown Object Identifier (Sub-id not found: iso -> iso)
Is this problem the reason why snmpget doens't work?
Either install the official patches for 5.3[0.1] or upgrade to 5.3.1.rc4
which works fine for me:

/my/net-snmp-5.3.1.rc4/bin/snmptranslate
.iso.org.dod.internet.mgmt.mib-2.ip.ipTrafficStats.ipSystemStatsTable.ipSystemStatsEntry.ipSystemStatsInDiscards
IP-MIB::ipSystemStatsInDiscards


+Thomas
--
Thomas Anders (thomas.anders at blue-cable.de)
Loading...