Re: [tkined] Two Basic Tnm Questions

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Sat, 7 Aug 1999 10:30:09 +0200

>>>>> Jeff Buddington writes:

Jeff> I have a couple of newbie questions:

Jeff> 1. Is it possible with a Tnm snmp session using a get request
Jeff> to have just the results of the get returned (without curly
Jeff> braces) and not have the OID repeated? Examples appreciated.

Just do a little bit of Tcl coding:

proc values {vbl} {
set result {}
foreach vb $vbl { lappend result [lindex $vb 2] }
return $result
}

values [$s getnext [mib children system]

In scotty 3.X.Y, you can simply write

Tnm::snmp value [$s getnext [Tnm::mib children system]]

since snmp value is a new primitive.

Jeff> 2. Does anyone have a very simple example of how to retrieve a
Jeff> whole table (such as a MIB-II routing table) row by row, not one
Jeff> column at a time and display it on the stdout?

You basically write:

$s walk vbl [Tnm::mib children ipNetToMediaEntry] {
puts [Tnm::snmp value $vbl]
}

Note, I am using the snmp value command here. You may want to use
whatever formatting functions you like.

Note that retrieving arbitrary tables is more complex for several
reasons. Look into the library .tcl files for more complex but more
general table retrieval code.
Juergen

-- 
Juergen Schoenwaelder  schoenw@ibr.cs.tu-bs.de http://www.cs.tu-bs.de/~schoenw
Technical University Braunschweig, Dept. Operating Systems & Computer Networks
Bueltenweg 74/75, 38106 Braunschweig, Germany.        (Tel. +49 531 / 391 3289)
--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.