[mrtg] Re: Newbie Question re: Getting Data
Mike Mitchell
Mike.Mitchell at sas.com
Fri May 14 20:00:39 MEST 2004
You want the ciscoDot11AssociationMIB file. The OID you're looking for is cDot11ActiveWirelessClients. The numeric form is 1.3.6.1.4.1.9.9.273.1.1.2.1.1.1
Here's a perl script I use to get the count of authenticated users (not associated). I named the script WiFiCnt, and call it from MRTG like:
Title[AP1]: WiFi Users on Access Point AP1
Directory[AP1]: WiFi
PageTop[AP1]: <H1>WiFi Users on Access Point AP1</H1>
WithPeak[AP1]: ymw
Options[AP1]: growright,noinfo,gauge,nopercent
MaxBytes[AP1]: 2048
Target[AP1]: `/opt/mrtg/local/WiFiCnt AP1 SSID1 SSID2`
Legend1[AP1]: Priv
Legend2[AP1]: UnPriv
Legend3[AP1]: Max Priv
Legend4[AP1]: Max UnPriv
LegendI[AP1]: Priv
LegendO[AP1]: UnPriv
YLegend[AP1]: AP1
I install MRTG in /opt/mrtg, so you'll have to change paths to suit your installation. Replace "AP1" with the name of your access point. Replace "SSID1" and "SSID2" with SSIDs appropriate for your organization.
Here's the script:
============== CUT ===================
#!/usr/local/bin/perl5
#
# Given the name of a WiFi access point and SSIDs, get the number of
# authenticated to those SSIDs and then the clients authenticated to
# other SSIDs.
#
# If no SSIDs are specified, the number of associated clients is returned,
# followed by the number of authenticated clients.
#
# Usage: WiFiCnt target [SSID] [SSID] [SSID] ...
#
# Uses the ciscoDot11AssociationMIB
#
BEGIN { push(@INC, "/opt/mrtg/lib/mrtg2"); };
use SNMP_util;
$aoid = "1.3.6.1.4.1.9.9.273.1.1.2.1.1.1"; # cDot11ActiveWirelessClients
$toid = "1.3.6.1.4.1.9.9.273.1.3.1.1.2.1"; # cDot11ClientUpTime table
$hst = shift(@ARGV);
$hst .= ":::::2" unless ($hst =~ /:/); # switch to SNMPv2
$chkSSID = ",,,,,,,,,,,,,,,,,,,,,"; # unlikely SSID to match
if ($#ARGV >= 0) {
$chkSSID = "";
foreach $ssid (@ARGV) {
$tmp = sprintf("%d.%s", length($ssid),
join(".", map(ord, split(//, $ssid))));
$chkSSID .= '|(' . $tmp . ')';
}
$chkSSID = substr($chkSSID, 1); # remove leading '|'
}
#
# Get a table of authenticated clients. The SSID is encoded in the instance.
#
@tbl = snmpwalk($hst, $toid);
$good = 0;
$other = 0;
foreach $val (@tbl) {
if ($val =~ /$chkSSID/o) {
$good++;
} else {
$other++;
}
}
# number of associated clients
($good) = snmpget($hst, $aoid) if ($#ARGV < 0);
print "$good\n$other\n";
============== CUT ===================
-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch] On Behalf Of chastaib at genco.com
Sent: Friday, May 14, 2004 12:49 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Newbie Question re: Getting Data
Greetings,
Okay, I've got MRTG up and running happily, and producing valid data.
Now, I want MORE!
I'm monitoring about 50 Cisco 1200 Access points. I want to know how
many users are associated to each access point.
I've read the faqs, I've research SNMP/MIB sites, but I'm stumped. I
know it's possible to get that information, but I don't know how to get
there from here.
Any help or guidance anyone can offer would be greatly appreciated.
Thanks,
Brian
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list