Reputation: 31
Is there a way to walk only one level of the tree with SNMP?
Example: I want to know how many tables my tree has but I don't want to walk each entry. It would be nice to only walk the parent level and return all OIDs for the root node of the table.
Upvotes: 2
Views: 1488
Reputation: 4970
Rather than use snmpwalk
(which I don't think supports the one level walk mentioned in question), it may be easier to get such info from the MIB file (instead of interrogating the agent).
It may be convenient to use tool like e.g. netsnmp snmptranslate
. E.g. to see what tables live in SNMPv2-MIB::system i.e. 1.3.6.1.2.1.1
, you could ...
snmptranslate -M +. -m +ALL -Tp -On SNMPv2-MIB::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
|
+-- ---- 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
Upvotes: 2