How to use pyWAD





Introduction

This is quick and dirty how to get something out of pyWAD. You'll need to have python2.1 or greater installed. I'll step through setting up pyWAD, how to get different values out of it, how to log those variables.

Prerequisites

Download

First you'll need the pyWAD distribution, you can get that here.

Getting down to business

Unpack the pyWAD:
% tar zxf pyWAD-xx.tar.gz

Now edit the pyWAD.cfg file to log interesting events, by adding a line like this in the "[NetLogger] " section:
....
AveBW1Min: (DataBytesIn*8)/(SndLimTimeRwin + SndLimTimeCwnd + SndLimTimeSender + 1)
....


The above means, output in netlogger format (because its in the NetLogger section of the configuration file and which is what NLV reads) a line that has the event called "AveBW1Min" and a value that is computed using the everything that comes after the colon,  so "(DataBytesIn*8)/(SndLimTimeRwin + SndLimTimeCwnd + SndLimTimeSender + 1)" which is composed of web100 variables is used to compute the value. The plus one is to keep from dividing by zero at startup.

And add a section like this, so that it will monitor a specified connection:

[my_test]
src_addr: 0.0.0.0
src_port: 8888
dst_addr: 0.0.0.0
dst_port: 0
force: 1
minwin: 65536
maxwin: 2097152


This means that we can start up a program listening on port 8888, and when we connect to it pyWAD will start monitoring that connection. ( src really refers to local and dst is remote in this context) Don't worry about the force, minwin & maxwin, for now. Force just means if the application manually set their window size, go ahead and reset it for them anyway. Minwin and maxwin are the lower and upper bounds to adjust the window size to. (you really don't want to ever set a window size to 0!)

By default pyWAD will log all its events to /tmp/pyWAD.log. We will leave this alone for now, but its worth noting that by setting the environment variable NETLOGGER_DEST you can redirect the output to any file you want (e.g. file:///tmp/foobar.log) or a url (e.g. x-netlog://foobar.lbl.gov).

Now let run it and see if we get some output (example is for csh):
 # add . to your PYTONPATH
% setenv PYTHONPATH .:$PYTHONPATH
% python2.1 pyWAD.py

and you should see something like:

setting avebw1min
will log to file  /tmp/pyWAD.log
Creating web100 utls
Getting connection ID's for all connections matching expression '.*:6666 .*:*'
Running . . . . . . . . . . .

Now the program outputs a lot of stuff, the short of list of what is means is:

Now if we start up a  server on port 8888 for some remote host  (lets say hostB):
% iperf -s -p 8888 >& /dev/null &

and we are on hostA (where pyWAD.py is running) and we start a client:
% iperf -c hostB -p 8888

we should see pyWAD.py output change to:

. . . . . . . . . . . . + > . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . *


which means that it found a new connection to monitor (the '+'), that it adjusted the window buffer for it (the '>') and that now its just leaving it alone (the '*'). At the end of the run we can go look at the data in /tmp/pyWAD.py and we should see something like the following.

% tail /tmp/pyWAD.log
DATE=20020516204325.348377 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=346.372686735
DATE=20020516204325.655913 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=346.807193845
DATE=20020516204325.965895 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=347.192892297
DATE=20020516204326.275841 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=347.093381056
DATE=20020516204326.585986 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=347.476575538
DATE=20020516204326.896010 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=347.848687768
DATE=20020516204327.206174 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=347.976135137
DATE=20020516204327.515974 HOST=foobar.lbl.gov PROG=pyWAD LEVEL=Usage NL.EVNT=avebw1min DST=131.243.2.185 DSTPRT=6666 SRC=131.243.2.87 SRCPDT=33289 ID=838 VAL=348.346109066