Re: [tkined] What's a better way to do this with the Tnm extensions

Doug Hughes (Doug.Hughes@Eng.Auburn.EDU)
Fri, 18 Sep 1998 16:09:54 -0500

eww.. yeah.. mui inefficient..

Try this (I put it in my .scottyrc)

proc walkit {handle mib args} {
if {[llength $args] > 0} {
set ofile [lindex $args 0]
} else {
set ofile stdout
}
$handle walk x $mib {
set oid [lindex [lindex $x 0] 0]
set name [mib name $oid]
set parent [mib parent $name]
set p2 [mib parent $parent]
puts -nonewline $ofile "$p2.$parent.$name "
puts $ofile " [lindex [lindex $x 0] 2]"
}
}

standard usage:
walkit $handle mib_object_or_oid

e.g. on a cisco:

% walkit $handle system
mib-2.system.sysDescr.0 Cisco Internetwork Operating System Software
IOS (tm) GS Software (GS7-K-M), Version 11.0(17), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-1997 by cisco Systems, Inc.
Compiled Thu 04-Sep-97 15:19 by richv
mib-2.system.sysObjectID.0 CISCO-MIB!c7000-sysID
mib-2.system.sysUpTime.0 306d 10:16:21.20
mib-2.system.sysContact.0
mib-2.system.sysName.0 au-bone4
mib-2.system.sysLocation.0
mib-2.system.sysServices.0 6

If you want to write to a file:

set f [open /tmp/ciscoout w]
walkit $handle cisco $f
close $f

This will print the last 3 components of the OID in ascii representation
if the appropriate .mib files have been loaded. Otherwise, you get
numerics.

--
____________________________________________________________________________
Doug Hughes					Engineering Network Services
System/Net Admin  				Auburn University
			doug@eng.auburn.edu

--
!! 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.