#!/usr/local/bin/perl
# perl script for Bay 5399/8000 history records ... John Kougoulos kugjon@panteion.gr
$callhist_no = 100;
$racaddr = $ARGV[0];
$raccommunity = $ARGV[1];
$miblocation = "/export/home/kugjon/ucdsnmp/ucd-snmp-3.5.3/MIBS" ;
$ucdsnmp = "/export/home/kugjon/ucdsnmp/ucd-snmp-3.5.3/apps" ;
if(open(TABLE, "$ucdsnmp/snmpwalk -M $miblocation $racaddr $raccommunity .1.3.6.1.4.1.15.2.16.2 > ras.snmp.out;cat ras.snmp.out |"))
{
$start = 0;
$oldvar = "";
$newvar = 0;
while (
)
{
/callHistEntry^callHistAsyEntry/;
chop;
@fields = split(/\=/,$_);
@semifields = split(/\./,$fields[0]);
if ( $semifields[7] ne $oldvar )
{
$oldvar = $semifields[7];
$newvar++;
# print $newvar." ".$semifields[7]."\n";
}
$fields[1] =~ s/\"//g;
$fields[1] =~ s/\s+(.*)/\1/;
$semifields[8] =~ s/(\d+).*/\1/;
$calldata{$semifields[8]}[$newvar] = $fields[1];
if(($start eq 0) && ($semifields[8] gt 0))
{
$start = $semifields[8];
}
}
}
close(TABLE);
if(open(STATSFILE,">ras.stats"))
{
$end = $start+$callhist_no-1;
# print $start." upto ".$end;
for( $i=$start ;$i<=$end;$i++)
{
#Post Processing
$calldata{$i}[2] =~ s/(\w+).*/\1/;
$aa = $calldata{$i}[1];
$user = $calldata{$i}[2];
$speed = $calldata{$i}[26];
$duration = int($calldata{$i}[13]/60)."m ".($calldata{$i." "}[13]%60)."s";
$beginrxspeed = $calldata{$i}[28];
$begintxspeed = $calldata{$i}[30];
$roundtripdelay = $calldata{$i}[49];
$snr = $calldata{$i}[54];
$endmodulation = $calldata{$i}[67];
$old = select(STATSFILE);
# $= = 2000;
select($old);
write STATSFILE;
}
}
close(STATSFILE);
system("cat ras.stats");
format STATSFILE_TOP =
A/A Username Disconnect Reason Duration RxSpeed TxSpeed RTD SNR Modul
----- ------------- ------------------------ -------- ---------------- --------------- --- ---- ------
.
format STATSFILE =
@<<<< @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<< @<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @<< @<<< @<<<<<
$aa, $user, $speed, $duration, $beginrxspeed, $begintxspeed,$roundtripdelay, $snr, $endmodulation
.