c has asked for the wisdom of the Perl Monks concerning the following question:

i've gotten to be somewhat comfortable using net::snmp. at the very least i've used its get_request and set_request methods. however an oid used by cisco seems to need to be called using 'snmpwalk' rather than a get or set request. net::snmp has a get_next_request and a get_table, but i'm confused if these are really the methods that would suit my purposes. is a true snmpwalk capable with net::snmp?

thanks -c

Replies are listed 'Best First'.
Re: snmpwalk using net::snmp
by very empty (Scribe) on Feb 07, 2002 at 04:19 UTC
    You can think about snmp as a tree.
    snmpwalk displays recursivly all the OIDS beneath a given node.
    OIDS are structured similiar to IP-numbers (which can be also represented by a tree) by a string consisting of dots and numbers.
    There are informations in this tree which are in common on many different devices (such as printer, router, switches, hosts, raid-arrays or uninteruptible power supplies). They are stored in a standard subtree. An example for this is the system subtree which contains information about sys-location or sys-contact.
    Other information is more vendor specific. It is stored in the enterprise subtree and enterprises may reserve there an numeric value for their own vendor-specific information.
    The clue point in using snmp is to find out which OIDS you want. Therefore you could use snmpwalk and try to guess the meaning of specific OIDS. This is easy if you want to retrieve the information which is displayed on the LCD of your networked printer but very difficult if you want inoctets of some network device on a switch. Therefore you might need a MIB (Message Information Base) which is a file containing alphanumerical translations of the numerical OIDS (like DNS does for IP-Numbers). In addition a MIB-file contains also explanations on OIDS. Those MIB-Files are usually provided by the manufacturer of your device or (concerning the standard tree) by the vendor of your snmp software (By vendor I mean the Open Source community, do not use buggy and expensive software here)
    Using snmpwalk to retrieve information isn't a good idea. You get lots of bullshit you do not want because the SNMP tree is a very large thing (you will also produce a lot of network traffic).
    Usually you want to get specific information on each interface of your cisco Therefore you might want to get system.iftable with snmptable (I am sorry, I am at home without access to our high security network to make sure I am giving you the correct OID)
    If you explain the complete problem I could probably give you some more assistance.

    Regards...
      I would have thought that, given a specific OID, an snmpget or snmpset would suffice. However given a specified example from Cisco, it seems that snmpwalk is required. Check out this CCO url and look near the mid to bottom of the page, specifically at steps #3 and #4. i've gone through this procedure, and it seems as though the router won't respond to a snmpget using the show OID. rather, it only responds to a walk.

      thanks! -c

        Yes you are right!
        In this example you really need snmpwalk bacause a whole tree should be copied. snmpget will not work because you will have lots of timeouts on all nodes which are not intended to have a value and on all nodes which do not exist. Setting a small timeout value might cause loosing values.

        Nevertheless a snmpwalk is -- as you said -- nothing else than a recursive get. Performing a bulkget seems also not possible, bacause the Cisco seems to use snmp version 1 only where bulkrequests are (I am not sure but I think so) not implemented.
        Therefore you should use the get_next_request() in a loop which takes the key of the returned hash as an argument for the next request and puts all OIDS and values in one hash. You might want to define a start-OID because usually not all values in the tree are R/W.
        Afterwards you set your configuration-values on the other router using set_request() for each key and voila the configuration is copied.

        Regards....
Re: snmpwalk using net::snmp
by Ryszard (Priest) on Feb 07, 2002 at 03:15 UTC
    I'm not an expert at SNMP, but isnt an OID (Object IDentifier) just an entry in a database?

    What i mean by this, is an OID is just a reference point, to get the associated information from - (or am i incorrect). The point being that i would expect an OID is get and walk-able by the very nature of what it is, meaning if you cant get it, you shouldnt be able to walk it either.

    I would also think that a walk is a recursive get.

    Again, I have to disclaim my knowledge of SNMP is quite limited.