Karlnet
[Top] [All Lists]

Re[2]: [Karlnet] Karlnet Perl Scripts

To: Karlnet Mailing List <karlnet@WISPNotes.com>
Subject: Re[2]: [Karlnet] Karlnet Perl Scripts
From: Jason Powell <jasonp@skynetaccess.com>
Reply-to: Jason Powell <jasonp@skynetaccess.com>, Karlnet Mailing List<karlnet@WISPNotes.com>
Date: Tue, 25 Feb 2003 17:33:08 -0500
List-post: <mailto:karlnet@WISPNotes.com>
Hello Darko,

Karlnet Mibs:

http://zgwireless.net/upload/karlnet-mibs.zip

I will try that script out and see how it works.  Thanks a ton!

Tuesday, February 25, 2003, 5:22:32 PM, you wrote:

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

DB> Hope this will help. Strange results if not used on satellites, though. Oh,
DB> yeah, you should be fortunate enough to get KBRIDGE-PUBLIC-MIB.txt from
DB> Karlnet's support, cause I'm not sure if it could be found on the web.

DB> #!/usr/bin/perl -w
DB> # started by Matija Nalis 2002/12
DB> # 
DB> # gets signal and noise from KB for MRTG
DB> # 
DB> use SNMP;

DB> my $DEBUG=0; 

DB> my ($ip, $community, $int) = @ARGV;

DB> $0 = "get_signalnoise $ip - $int";      # remove password from cmdline 
(yeah, lame and racy...)

DB> if ($#ARGV != 2) {
DB>   print STDERR "Invalid arguments!\n";
DB>   exit 10;
DB> }

DB> $DEBUG && print "$community\@$ip - int $int\n";

DB> SNMP::initMib();
DB> SNMP::addMibFiles('/usr/share/snmp/mibs/KBRIDGE-PUBLIC-MIB.txt');
DB> $sess = new SNMP::Session(DestHost => $ip, Community => $community);

DB> if ($DEBUG) {
DB>   my $sysname = $sess->get('sysName.0');
DB>   print "sysName=$sysname\n";
DB> }

DB> my $idx = -1;   # found our interface here

DB> # set up the data structure for the getnext command
DB> $vars = new SNMP::VarList( ['kbWirelessStationInterfaceNumber'] );

DB> # get first row
my $tint = $sess->>getnext($vars);
die $sess->>{ErrorStr} if ($sess->{ErrorStr});

DB> # and all subsequent rows
while (!$sess->>{ErrorStr} and 
DB>        $$vars[0]->tag eq "kbWirelessStationInterfaceNumber"){
DB>     my $pos = $$vars[0]->iid;
DB>     $DEBUG && print " test $pos -> $tint\n";
DB>     if ($tint == $int) { $idx = $pos; $DEBUG && print "FOUND! IDX=$idx\n"; }
DB>     $tint = $sess->getnext($vars);
DB> };

DB> if ($idx < 0) {
DB>         $DEBUG && print STDERR "wireless index not found for interface $int 
at ip $ip";
DB>         exit 1;
DB> }

DB> if ($DEBUG) {
DB>   my $linkto = $sess->get("kbWirelessStationName.$idx");
DB>   print "link to $linkto\n";
DB> }

my $signal = $sess->>get("kbWirelessStationSignalLevel.$idx");
DB> my $mysignal = $signal / -2 + 94;
DB> $DEBUG && print "signal=$signal (my=$mysignal)\n";

my $noise = $sess->>get("kbWirelessStationNoiseLevel.$idx");
DB> my $mynoise = $noise / -2 + 94;
DB> $DEBUG && print "noise=$noise (my=$mynoise)\n";

DB> print "$mysignal\n$mynoise\n";
DB> exit 0;




-- 
Best regards,
 Jason                            mailto:jasonp@skynetaccess.com

<Prev in Thread] Current Thread [Next in Thread>