On Tue, Feb 25, 2003 at 04:28:09PM -0500, Dan Metcalf wrote:
> NO doubt, KARLNET - WE NEED SOMETHING TO graph snr over time, I use mrtg
> & cricket, but I have yet to actually do that or see a working script!
Hope this will help. Strange results if not used on satellites, though. Oh,
yeah, you should be fortunate enough to get KBRIDGE-PUBLIC-MIB.txt from
Karlnet's support, cause I'm not sure if it could be found on the web.
#!/usr/bin/perl -w
# started by Matija Nalis 2002/12
#
# gets signal and noise from KB for MRTG
#
use SNMP;
my $DEBUG=0;
my ($ip, $community, $int) = @ARGV;
$0 = "get_signalnoise $ip - $int"; # remove password from cmdline (yeah,
lame and racy...)
if ($#ARGV != 2) {
print STDERR "Invalid arguments!\n";
exit 10;
}
$DEBUG && print "$community\@$ip - int $int\n";
SNMP::initMib();
SNMP::addMibFiles('/usr/share/snmp/mibs/KBRIDGE-PUBLIC-MIB.txt');
$sess = new SNMP::Session(DestHost => $ip, Community => $community);
if ($DEBUG) {
my $sysname = $sess->get('sysName.0');
print "sysName=$sysname\n";
}
my $idx = -1; # found our interface here
# set up the data structure for the getnext command
$vars = new SNMP::VarList( ['kbWirelessStationInterfaceNumber'] );
# get first row
my $tint = $sess->getnext($vars);
die $sess->{ErrorStr} if ($sess->{ErrorStr});
# and all subsequent rows
while (!$sess->{ErrorStr} and
$$vars[0]->tag eq "kbWirelessStationInterfaceNumber"){
my $pos = $$vars[0]->iid;
$DEBUG && print " test $pos -> $tint\n";
if ($tint == $int) { $idx = $pos; $DEBUG && print "FOUND! IDX=$idx\n"; }
$tint = $sess->getnext($vars);
};
if ($idx < 0) {
$DEBUG && print STDERR "wireless index not found for interface $int at
ip $ip";
exit 1;
}
if ($DEBUG) {
my $linkto = $sess->get("kbWirelessStationName.$idx");
print "link to $linkto\n";
}
my $signal = $sess->get("kbWirelessStationSignalLevel.$idx");
my $mysignal = $signal / -2 + 94;
$DEBUG && print "signal=$signal (my=$mysignal)\n";
my $noise = $sess->get("kbWirelessStationNoiseLevel.$idx");
my $mynoise = $noise / -2 + 94;
$DEBUG && print "noise=$noise (my=$mynoise)\n";
print "$mysignal\n$mynoise\n";
exit 0;
--
Darko Budor <budor (at) vodatel (dot) hr>
|