Would anyone care to share an snmp script such as maxstatus for the cisco? I'd be eternally grateful. --maxstatus-- #!/bin/sh # natsu@itjit.ad.jp May 18, 1996 # natsu@itjit.ad.jp May 20, 1996 fixed Error: can't read # "sessionStatusEntry(x)": no such # element in array # natsu@itjit.ad.jp Dec 19, 1996 clean exit when snmp walk fails # thanks tony@nol.net (@neosoft.com now) # # maxstatus <ip> [<community>] # # you'll get an output like: # # Speed Elapsed Time User IP Address Subnet Mask Service # ------- -------------- -------- --------------- --------------- ------- # 64000 0d 23:59:38.00 itjspd05 202.242.46.167 255.255.255.255 ppp # 26400 0d 0:07:36.00 itjsys22 202.242.46.172 255.255.255.255 ppp # 64000 0d 2:28:32.00 itjadv01 202.242.46.162 255.255.255.255 ppp # 28800 0d 0:35:46.00 its00086 202.242.46.169 255.255.255.255 ppp # 64000 0d 0:00:25.00 soros1 202.217.132.192 255.255.255.255 ppp # # Summary # ---------- # 64000: 3 # 28800: 1 # 26400: 1 # -- # 5 # # Ok I stole code from ifload and ifload.tcl that come wich scotty. They were # very helpful. # Tcl sees the next lines as an assignment to variable `kludge'. # For sh, the two shifts cancel the effect of the set, and then we # run scotty on this script. set kludge { $* shift shift if test -f ../scotty ; then exec ../scotty -nf $0 $* else exec /usr/bin/scotty -nf $0 $* fi } if {$argc < 1 || $argc > 2} { puts stderr {usage: maxstatus <ip> [<community>]} exit 1 } set host [lindex $argv 0] set community [expr {$argc == 2 ? [lindex $argv 1] : "public"}] mib load ascend.mib set code [catch {snmp session -address $host -community $community} s] if $code { puts stderr $s exit 1 } set code [catch {$s walk vbl callStatusIndex { set callStatusIndex [lindex [lindex $vbl 0] 2] set vbl [$s get " callStatusValidFlag.$callStatusIndex \ callStatusStartingTimeStamp.$callStatusIndex \ callStatusDataRate.$callStatusIndex \ callSessionIndex.$callStatusIndex \ sysUpTime.0 \ "] set callStatusValidFlag [lindex [lindex $vbl 0] 2] if {$callStatusValidFlag == "valid"} { set callStatusStartingTimeStamp [lindex [lindex $vbl 1] 2] set callStatusDataRate [lindex [lindex $vbl 2] 2] set callSessionIndex [lindex [lindex $vbl 3] 2] set sysUpTime [lindex [lindex $vbl 4] 2] # build a table with $callSessionIndex as the key # $sysUpTime contains spaces, and I don't want its columns to get separated set callStatusEntry($callSessionIndex) [list \ $callStatusStartingTimeStamp \ $callStatusDataRate \ [list $sysUpTime] \ ] } }}] if $code { puts stderr $s exit 1 } $s walk vbl ssnStatusIndex { set ssnStatusIndex [lindex [lindex $vbl 0] 2] set vbl [$s get " ssnStatusValidFlag.$ssnStatusIndex \ ssnStatusUserName.$ssnStatusIndex \ ssnStatusUserIPAddress.$ssnStatusIndex \ ssnStatusUserSubnetMask.$ssnStatusIndex \ ssnStatusCurrentService.$ssnStatusIndex \ "] set ssnStatusValidFlag [lindex [lindex $vbl 0] 2] if {$ssnStatusValidFlag == "valid"} { set ssnStatusUserName [lindex [lindex $vbl 1] 2] set ssnStatusUserIPAddress [lindex [lindex $vbl 2] 2] set ssnStatusUserSubnetMask [lindex [lindex $vbl 3] 2] set ssnStatusCurrentService [lindex [lindex $vbl 4] 2] set ssnStatusCallReferenceNum [lindex [lindex $vbl 5] 2] # boild a table with $ssnStatusIndex as key set sessionStatusEntry($ssnStatusIndex) " $ssnStatusUserName \ $ssnStatusUserIPAddress \ $ssnStatusUserSubnetMask \ $ssnStatusCurrentService \ " } } puts "Speed Elapsed Time User IP Address Subnet Mask Service" puts "------- -------------- -------- --------------- --------------- -------" # select * from callStatusEntry, sessionStatusEntry # where callSessionIndex = ssnStatusIndex foreach callSessionIndex [array names callStatusEntry] { # we only want the intersection of the two tables if {![info exists sessionStatusEntry($callSessionIndex)]} continue set callStatusStartingTimeStamp [ \ lindex $callStatusEntry($callSessionIndex) 0 \ ] set callStatusDataRate [lindex $callStatusEntry($callSessionIndex) 1] set sysUpTime [lindex [lindex $callStatusEntry($callSessionIndex) 2] 0] set ssnStatusUserName [lindex $sessionStatusEntry($callSessionIndex) 0] set ssnStatusUserIPAddress [lindex $sessionStatusEntry($callSessionIndex) 1] set ssnStatusUserSubnetMask [lindex $sessionStatusEntry($callSessionIndex) 2] set ssnStatusCurrentService [lindex $sessionStatusEntry($callSessionIndex) 3] # $callStatusStartingTimeStamp is in seconds, but sysUpTime is expected to be # in hundreds of a second set callDuration [mib format sysUpTime [ \ expr [mib scan sysUpTime $sysUpTime] - 100 * $callStatusStartingTimeStamp \ ]] puts "$callStatusDataRate $callDuration $ssnStatusUserName\t$ssnStatusUserIPAddress\t$ssnStatusUserSubnetMask\t$ssnStatusCurrentService" # count how many 64k's, 28.8k's, etc. # you have to make sure the variable exists before you increment it set dataRateCount($callStatusDataRate) [expr { ([info exists dataRateCount($callStatusDataRate)]) ? [incr dataRateCount($callStatusDataRate)] : 1 }] } exit 0 ++ Ascend Users Mailing List ++ To unsubscribe: send unsubscribe to ascend-users-request@bungi.com To get FAQ'd: <<A HREF="http://www.nealis.net/ascend/faq">http://www.nealis.net/ascend/faq</A>> </PRE> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <HR> <UL> <LI>Prev by Date: <STRONG><A HREF="msg09390.html">Re: (ASCEND) Unique Session ID ?</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg09387.html">(ASCEND) P50</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg20833.html">(ASCEND) P50</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg09399.html">(ASCEND) 56K problems</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="mail458.html#09389"><STRONG>Main</STRONG></A></LI> <LI><A HREF="thrd199.html#09389"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> </BODY> </HTML>