Ascend Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(ASCEND) Ascend & MRTG (kinda solution)



Hi,

if you want to log the traffic of several leased line profiles of your
Maxes you are eventually bugged by the fact that these lines get a new
ifIndex whenever they go down and up again. 5.1A will have severe changes
to the MIBs in order to make this less of a problem. As long as 90% of
the world is on 5.0Ap (we are back on p13...) it is hard to log leased
lines with MRTG if you don't have a way to automatically retrieve the
correct ifIndex. The following scotty script does this - it produces
MRTG "Target" lines for your pleasure. Typical usage:

#!/bin/sh
cd /path/to/mrtg/workdir
./ascend2mrtg router1 > mrtg.cfg
./ascend2mrtg router2 >> mrtg.cfg
cat mrtg.cfg.static >> mrtg.cfg
./mrtg mrtg.cfg

ascend2mrtg asks the indicated router for its seesionActiveTable and call-
StatusTable (callActiveTable is dead in 5.0Ap) and uses the information
to finally get the ifIndex of the interface the profile is currently
bound to.

This is a quick hack and has some bugs:

1) Only on Maxes. Seems Pipelines miss some MIB info the script needs
2) Load. Firing up scotty and parsing tons of MIBs is havoc for just
   one question. I was thinking about writing a general "guard" program
   (project name "Nobby") which constantly runs, retrieves statistics,
   does pings, rings alarm bells and pages you out of sleep. But I found
   out I hate Tcl...
3) Only single profiles. This version will not work when you use any kind
   of highlevel bundling (anything which appears to produce more than
   one time the same ssn*UserName). Maybe I fix this, but I dont think
   so - 5.1A will likely have a solution.
4) If lines go down, _no_ Target line is produced. This makes MRTG
   less happy. It would be a good idea to initially get the ifIndex
   of rj0 or bh0 and crank that in - they never seem to see any ifIn-
   or ifOutOctets. Strange enough, wanidle0 doesn't qualify for this,
   it sees lots of traffic.
4) You need scotty. This means you need tk. And tcl. And a lot of time
   to get this all running and crank the Ascend MIBs into it. Anyone
   know of a good SNMP interface to Python ?

Ok, follows the hack:

------------------- >8 ---------------------
#!/usr/local/bin/scotty2.1.5

#
# Generate "Target" lines for an MRTG config file by retrieving the
# currently valid ifIndex values through peeking in the Ascend enterprise
# MIBs

# The profile names for which to generate Targets

set profiles {foo-gate1 bar-gate zilch-gate foo-gate2}

# TCL sucks...
# "Constants"

set aSsn "ascend.sessionStatusGroup.sessionActiveTable.sessionActiveEntry"
set aSsnQ "$aSsn.ssnActiveUserName $aSsn.ssnActiveIndex"

set aCll "ascend.callStatusGroup.callStatusTable.callStatusEntry"
set aCllQ "$aCll.callSessionIndex $aCll.callStatusIfIndex"

# Handle arguments

set agent [lindex $argv 0]

if {$agent == ""} {
 set agent 127.0.0.1
}

set comm [lindex $argv 1]

if {$comm == ""} {
 set comm "public"
}

set s [snmp session -address $agent -community $comm]

set userNameList {}
set sessionIxList {}
set callSessionIxList {}
set interfaceList {}

$s walk x $aSsnQ {
 lappend userNameList [lindex [lindex $x 0] 2]
 lappend sessionIxList [lindex [lindex $x 1] 2]
}

$s walk x $aCllQ {
 lappend callSessionIxList [lindex [lindex $x 0] 2]
 lappend interfaceList [lindex [lindex $x 1] 2]
}

set k 0
foreach ix $sessionIxList {

 set user [lindex $userNameList $k]
 set k [expr $k + 1 ]

 # Argh - is there no "in" in TCL ?

 if { [lsearch -exact $profiles $user] != -1 } {
  
  # Get the entry in the callStatusGroup which claims to have this session
  # related to it
  set ix [lsearch -exact $callSessionIxList $ix]

  # Get the ifIndex the found callStatusGroup entry is linked to
  set ix [lindex $interfaceList $ix]

  # Generate the resulting target line
  puts "Target\[$user\]: $ix:$comm@$agent\n"
 }
}

exit
------------------- 8< ---------------------

Do what you want with it. If you enhance it please share with us ;)

Andre.
-- 

Kanther-Line: PGP SSH IDEA MD5 GOST RIPE-MD160 3DES RSA FEAL32 RC4

+-o-+--------------------------------------------------------+-o-+
| o |               \\\- Brain Inside -///                   | o |
| o |                   ^^^^^^^^^^^^^^                       | o |
| o | Andre' Beck (ABPSoft) beck@ibh-dd.de XLink PoP Dresden | o |
+-o-+--------------------------------------------------------+-o-+
++ Ascend Users Mailing List ++
To unsubscribe:	send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd:	<http://www.nealis.net/ascend/faq>