SNMP usage question

Hi, and sorry if this has been answered before.

I would like to log the wireless client table. The associated SNMP MIBs are:
1.3.6.1.4.1.14988.1.1.1.2.1.1 - mac addresses
1.3.6.1.4.1.14988.1.1.1.2.1.3 - signal strength

I can, of course, do a SNMPWALK and grab the relevant information, but I cannot figure out how to get the dude to log it. I could write a perl script on the back-end to get this done (similar to pulling arp cache from a cisco router), but I’d really like to do this within the dude server itself. I have set up an array_size probe successfully, but cannot seem to log the entire array. Any help would be appreciated.

I have not seen this done, the one thing I would like to do is save the serial number and version of my devices in the device list so when the device is down you can quickly send this information to a vendor… I could see looking in the device list and having the value of probes being listed in other columns but tracking each mac address is probably slightly out of scope for the dude. Although you could easily graph signal strength you will need to create generic probes that just graph when someone is connected and not follow the mac address. If this is a wireless network and people move around all the time the graphing of users moving in and out of access areas is going to be very “noisy” and what good would be the information if you don’t have the associated mac address so I feel your pain? I suspect you might find one user who is not moving but is having issues but they will call if they do. So you are correct make an external script…

HTH,
Lebowski

I am by no means a programmer. I am just a routing and switching guy. That said, if anyone is interested, here is my script that keeps track of signal strength in the client list by mac address. Basically the customer that has this mikrotik is not willing to password protect it, but has tons of people mooching off of his connection. I crontab this to run every hour, and just do a search for a mac address in the entire directory (grep "04 B6" ./) for example. This will show me if someone has been connected for 90% of the system uptime over the course of a month...at a coffee hotspot. If so, they get the blacklist stick.

Once again, disclaimer is I am not at all a programmer, and I'm sure there are better ways to do this, but hey, hopefully this helps someone.

Output of the script will look like this:
client 5 -82
00 16 00 16 00 BB

client 4 -78
00 17 00 17 00 DD

client 3 -84
00 18 00 18 BB EF

client 2 -50
00 19 00 19 EB AB

client 1 -66
00 20 00 20 7E CC

The crontab entry would look like this:
0 */1 * * * root wirelessclients 10.248.0.1


And, the script:
#!/usr/bin/perl

wirelessclients -- a script to extract active client list from a mikrotik AP

get timestamp reference

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = $year+1900;
$mon++;
if ( $hour < 10 ) {
$hour = "0".$hour;
}
if ( $min < 10 ) {
$min = "0".$min;
}
if ( $mon < 10 ) {
$mon = "0".$mon;
}
if ( $mday < 10 ) {
$mday = "0".$mday;
}

$timestamp = $year.$mon.$mday.$hour.$min;

#init SNMP community and target MIB
$snmpro="omittedforfun";
$snmpmib="1.3.6.1.4.1.14988.1.1.1.2.1";

#user input of host IP
chomp ($rtr=$ARGV[0]);
if ( $rtr eq "" ) {die "$0: Must specify a router \n"};

congeal SNMP command into shapeless mass

$snmpwalk="/usr/local/bin/snmpwalk -v 2c -c $snmpro $rtr $snmpmib";

#open file to write to - note it will not create the dir so $rtr (user input host IP) must be manually created
open (OUT, ">/usr/local/var/log/wireless/clients/$rtr/$timestamp");
print "\n opening file /usr/local/var/log/wireless/clients/$rtr/$timestamp \n";

#execute SNMP shapeless mass and remove the MIB portion, only keeping actual data
@linewalk=$snmpwalk;
foreach $line (@linewalk) {
($mib, $hex) = split ("=", $line);
($junk, $keep) = split (/:/, $hex);
push (@linetruncate, "$keep");
}
foreach $line (@linetruncate) {
if ($line =~ m/-.*/) {
push (@db, "$line");
}
if ($line =~ m/[0-9A-Fa-f]{1,2} [0-9A-Fa-f]{1,2} [0-9A-Fa-f]{1,2} [0-9A-Fa-f]{1,2} [0-9A-Fa-f]{1,2} [0-9A-Fa-f]{1,2}/){
push (@mac, "$line");
}

}

pass array into scalar to count lines

$dbcount = @db;
$maccount = @mac;

#print line by line decrementing the counter each time
while ($dbcount > 0) {
printf (OUT "client %s %s %s \n", $dbcount, $db[-$dbcount], $mac[-$dbcount]);
$dbcount--;
}

print "\n done printing to file \n";
close OUT;