Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida


#1 Post by chadd » Fri Apr 13, 2007 11:44 am

First of all, let me say that I know this is not specifically related to Cacti - but, I think it could be useful to others. The Cacti community has been great to me and it has been a while since I contributed anything, so I hope this script makes someone happy ;-). At the least, people could make use of parts of the code, at best, someone could add to it (maybe even make it a plugin ;-) and make it better.

The user interface is pretty primitive, and it is written in Perl. It currently only works on Cisco APs. The perl modules/software required are as follows:

Data::Validate::IP qw(is_ipv4);
Net-SNMP (used for collecting statistics from the APs - not the perl module, the actual software).

The purpose of the script is to find a wireless client (based on MAC address) and follow that client throughout the wireless network - reporting various statistics on the clients connection along the way. I wrote it to help trouble shoot wireless connectivity issues at the place I work.

It runs well in a UNIX shell, and I have not tried it in Windows(though I suspect there will be issues). I run it in Ubuntu(Edgy) and Freebsd(6.1).

It requires a pretty large terminal screen dimension, and does not resize auto matically(Term::Screen). Here is the usage:

USAGE: wifitrace.pl [AP IP list] [mac address to trace] [time to trace
for in seconds] [options]


--help(-h) produces a brief help message
--version(-v) produces version information
--ips(-f) List of AP IP addresses(,)read SNMP community name (REQUIRED)
--mac(-m) MAC address of client you are searching for (REQUIRED)
--runtime(-t) Amount of time in seconds you want to trace the client (REQUIRED)
--log(-l) Specify a file to log to for this session

The AP IP List must be the first argument on the command line.
The MAC address and Runtime arguments are also required, but can
be given either in order ([MAC] [Runtime]), or by using the
switch, you can place them in whatever order you wish. If you
specify a logfile, the program will write statistics to it every
second that the client is connected to an AP. You do not need to
specify a file name extension, as WIFItrace will make it a .csv

Send all bugs, questions or comments to chadd.

Basically, you feed it a comma delimited list of AP IP address(example: all the APs at a location), where the list is as follows: IP,SNMP Read Community String. The program checks each IP for connectivity, then reads the valid ones into memory. It then scans the CAM tables of the APs, searching for the client MAC address you specified. When it finds the client, it begins to report statistics on that clients connection (from the APs point of view) until that client is no longer attached to that AP. Then the search begins again. There is an audit trail(per say) created, showing you a list of APs the client has visited.

This program was written as a proof of concept, and I am too busy to write it in a compiled language to make it more widely usable. It is hosted on a server here where I work, and is used as intended. I only have Cisco 1200 series APs to test with, because that is all we have, so if you need support for other vendors... You know the rest..

Like I said, I hope this is useful in whole, or in part by someone. Attached are a couple of screen shots of the program in action.
I removed one of the screen shots. Here is the script.
(21.4 KiB) Downloaded 810 times
WifiTrace-Searching.png (480.52 KiB) Viewed 8451 times
WifiTrace-Client-Found.png (466.03 KiB) Viewed 8451 times
Last edited by chadd on Mon Apr 16, 2007 3:21 pm, edited 2 times in total.

Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

#2 Post by chadd » Fri Apr 13, 2007 12:01 pm

Sorry, I can't post the script due to a 2M upload limit.. When I can, I will. Thanks,


User avatar
Cacti Moderator
Posts: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#3 Post by BSOD2600 » Fri Apr 13, 2007 2:27 pm

Might be better to post the cacti related screenshots of the end results instead of wifitrace in action...

Post Reply