\n";
}
#$radioLocation{$vals[0]} = $vals[3];
$radioLocation{$vals[0]} = $vals[2];
$radioStatus{$vals[0]} = $vals[1];
} #end while
if ($DEBUG) {
for my $index (keys %radioLocation) {
print "802.11b Radio $index is located at $radioLocation{$index}
\n";
}
}
return 1;
}
##############################################################################
# Subroutine get_main
#
# Purpose: this is the meat and potatoes of the script
##############################################################################
sub get_main {
# Declare Local Variables
my $intf = 0;
my $font = "";
my $dnsname;
while (1) {
$intf++; # Index for SNMP walks
my $vars = new SNMP::VarList(
['ccMUInfoIndex', $intf], # 0 0
#['ccMUInfoType', $intf], # 1
['ccMUInfoMac', $intf], # 2 1
['ccMUInfoIP', $intf], # 3 2
['ccMUInfoWlan', $intf], # 4 3
['ccMUInfoEssid', $intf], # 5 4
['ccMUInfoAP', $intf], # 6 5
#['ccMUInfoAPState', $intf], # 7
#['ccMUInfoSecState', $intf], # 8
#['ccMUInfoCurRate', $intf], # 9
#['ccMUInfoSupRates', $intf], # 10
['ccMUInfoRssi', $intf], # 11 6
#['ccMUInfoPsp', $intf], # 12
#['ccMUInfoIntf', $intf], # 13
['ccMUInfoAsscUptime', $intf], # 14 7
#['ccMUInfoTktExp', $intf], # 15
['ccMUInfoUserName', $intf], # 16 8
#['ccMUInfoPktTx', $intf], # 17
#['ccMUInfoPktRx', $intf], # 18
#['ccMUInfoBytesTx', $intf], # 19
#['ccMUInfoBytesRx', $intf], # 20
['ccMUInfoLastAct', $intf], # 21 9
#['ccMUInfoVlan', $intf], # 22
['ccMUInfoAuthState', $intf], # 23 10
#['ccMUInfoAuthMethod', $intf], # 24
#['ccMUInfoUniEncrType', $intf], # 25
['ccMUInfoBCMCEncrType', $intf] ); # 26 11
@vals = $sess->get($vars); # retreive SNMP information
#if ( $sess->{ErrorStr} ) {
# print "DEBUG: sess->{ErrorStr} = $sess->{ErrorStr}\n";
#}
last if ($vals[0] eq "");
$number_devices++; # Counter for number of MUs
# Let's perform a DNS lookup to get the FQDN of the MU
$dnsname = ( gethostbyaddr (inet_aton ($vals[2]), AF_INET) || "UNRESOLVED" );
$dnsname =~ s/\.local\.domain\.root//g; # Let's drop the FQDN from the hostname
my %murow = ( INDEX => $vals[0],
MUMAC => $vals[1],
MUIP => $vals[2],
WLAN => $vals[3],
ESSID => $vals[4],
APMAC => $vals[5],
APLOC => $radioLocation{$vals[5]},
USER => $vals[8],
###APSTATE => $vals[7],
AUTHSTATE => $vals[10],
ENCRTYPE => $vals[11],
RSSI => $vals[6],
ASOCTIME => &timefromsec($vals[7]),
LASTACT => &timefromsec($vals[9]),
DNSHOST => $dnsname
);
# put this row into the loop by reference
push(@muloop, \%murow);
} # end while
$template->param( USERLOOP => \@muloop );
return 1;
}
###########################################################
# Subroutine calc_down_time
#
# Purpose: calculate downtime given to time references
###########################################################
sub timefromsec {
# Declare Local Variables
my $cTime = shift;
my $iTime; # days:hours:minutes:seconds
my ($iDays, $iHours, $iMins, $iSecs);
# Do the math
if ($cTime != 0) {
$iTime = $cTime;
$iSecs = $iTime % 60;
$iTime -= $iSecs;
$iMins = $iTime % 3600;
$iTime -= $iMins;
$iMins /= 60;
$iHours = $iTime % 86400;
$iTime -= $iHours;
$iHours /= 3600;
$iDays = $iTime / 86400;
if ($iSecs < 10) { $iSecs = "0" . $iSecs }
if ($iMins < 10) { $iMins = "0" . $iMins }
if ($iHours < 10) { $iHours = "0" . $iHours }
# Put it all together
$iTime = "$iDays:$iHours:$iMins:$iSecs";
} else {
$iTime = "0:00:00:00";
}
return $iTime;
} #end sub timefromsec
############################################################################
# Subroutine check_ap
#
# Purpose: check that all Access Points are online and operational and
# alert the operator if there is a problem detected
############################################################################
sub check_ap {
# Declare Local Variables
my $test;
for my $index (keys %radioStatus) {
if ($radioStatus{$index} eq "unavailable") {
$template->param(APHELP => 1);
my %aprow = ( INDEX => $index,
APLOC => $radioLocation{$index});
# put this row into the loop by reference
push(@aploop, \%aprow);
}
}
$template->param(APLOOP => \@aploop);
return 1;
} #end sub check_ap