IPERF CSV Data Summary Script

Recently I was required to do a network performance test between a Head Office and a WAN site. I knocked up this quick python script to parse the data collect to see the results. Thought it could be handy for others so here it is to download / share.

Download Script

Sample Output:

cooper@dfbit:~/scripts/iperf-parse$ ./iperf-summary.py
— IPERF CSV Summariser —
— Cooper Lees <me@cooperlees.com —
– 20111212103043 to 20120103090052
– 1004 runs of IPERF
– Averages:
– Average Sent = 2.64M
– Average Received = 2.28M
– Average Send Bandwidth = 985.75K
– Average Receive Bandwidth = 805.12K
– Max Send Bandwidth = 1.08M (at 20111230183021)
– Max Receive Bandwidth = 837.16K (at 20120102113052)



# date,sender-ip,sender-port,receiver-ip,receiver-port,id,interval,transfer,bandwidth
# 20111212103043,,45020,,5001,5,0.0-21.4,2490368,931080
# 20111212103109,,5001,,57022,4,0.0-24.2,2228224,736145

FILENAME = ‘client-iperf.log’

RUNS = 1




def convert_bytes(bytes):
bytes = float(bytes)
if bytes >= 1099511627776:
terabytes = bytes / 1099511627776
size = ‘%.2fT’ % terabytes
elif bytes >= 1073741824:
gigabytes = bytes / 1073741824
size = ‘%.2fG’ % gigabytes
elif bytes >= 1048576:
megabytes = bytes / 1048576
size = ‘%.2fM’ % megabytes
elif bytes >= 1024:
kilobytes = bytes / 1024
size = ‘%.2fK’ % kilobytes
size = ‘%.2fb’ % bytes
return size

f = open(FILENAME)
l1 = f.readline().strip().split(‘,’)
l2 = f.readline().strip().split(‘,’)
while l2 and l2[0] != ”:
if RUNS == 1:
START = l1[0]

BW_SENT = int(l1[8])
BW_RECEIVED = int(l2[8])

TOTAL_SENT = TOTAL_SENT + int(l1[7])




END = l2[0]
l1 = f.readline().strip().split(‘,’)
l2 = f.readline().strip().split(‘,’)


print "————————————"
print " — IPERF CSV Summariser — "
print "– Cooper Lees <me@cooperlees.com –"
print "————————————"
print "– SUMMARY –"
print "- %s to %s" % ( START, END )
print "- %d runs of IPERF" % RUNS
print "- Averages:"
print "-tAverage Sentttt= %s" % convert_bytes((TOTAL_SENT / RUNS))
print "-tAverage Receivedtt= %s" % convert_bytes((TOTAL_RECEIVED / RUNS))
print "-tAverage Send Bandwidthtt= %s" % convert_bytes((TOTAL_BANDWIDTH_SENT / RUNS))
print "-tAverage Receive Bandwidtht= %s" % convert_bytes((TOTAL_BANDWIDTH_RECEIVED / RUNS))
print "-tMax Send Bandwidthtt= %s (at %s)" % (convert_bytes((MAX_BANDWIDTH_SENT)), MAX_BANDWIDTH_SENT_DATE)
print "-tMax Receive Bandwidthtt= %s (at %s)" % (convert_bytes((MAX_BANDWIDTH_RECEIVED)), MAX_BANDWIDTH_RECEIVED_DATE)
print "————————————"

Cron Job Script to Collect Data:



echo "–> Starting iperf client @ $(date) …" | tee -a $LOG

if [ "$1" == "-v" ]; then
iperf -t $TIME -c $SERVER -r -y C | tee -a $LOG
iperf -t $TIME -c $SERVER -r -y C >> $LOG

echo "–> Finished iperf client @ $(date)" | tee -a $LOG

Mac OS X 10.7 Lion + ATEN UC232A USB to Serial Adapter

32- and 64-bit PL2303 drivers for OS X 10.6 are available here.

You’ll need to modify, as root, the ‘/System/Library/Extensions/ProlificUsbSerial.kext/Contents/Info.plistΒ ‘ file after installing the driver to suit the USB manufacturer and device ID. For the ATEN UC232A, examples below appear to work for it (for me in 10.7).

To obtain the IDs, Wayne Roberts (who informed my via the SAGE-AU mailing lists), used ‘USB Prober.app’ which comes with the developer tools/XCode.

Modify the current lines of the XML:

# <key> can be the Hex values as ‘Vendor’_’Product’, Wayne thinks this is more cosmetic however.


# <idProduct> and <idVendor> should be the decimal of the respective values, as per USB Prober.app

Once you’ve done this, either restart the machine or run ‘kextunload’ and ‘kextload’ on ProlificUsbSerial.kext and it should show up as /dev/tty.usbserial.

** If you have installed the UC232A Drivers, either rm or mv the ‘UC-232AC.kext’ before the reboot to avoid conflicts **

GPU Upgrade – 9800gt to 280gtx

So I have parted my cheeks and bought a new Nvidia GTX 280gtx for my Hackintosh / Win7 i7 920 6gb of memory desktop machine. It also caused me to buy a new Coomaster 650W PSU to power the power hungry fella and Zalman 10x Quiet CPU Cooler. Dam it’s a nice GPU, despite it requiring 40 amps on the 12v rail !

So I did some benchmarking …

Nvidia 9800gt 3d Mark Score
Nvidia 9800gt 3d Mark Score
Nvidia 280tgtx 3d Mark Score
Nvidia 280tgtx 3d Mark Score

So we can see a small increase there, especially on the raw GPU score … πŸ™‚

And apparently my Windows experience is now better !

Windows with a 9800gt
Windows with a 9800gt
Windows with a 280gtx
Windows with a 280gtx

So, time for me to get Steam again and come back to some online gaming … Let me know what I should be playing πŸ™‚

Apple Mac OS X Time Machine over NFS (10.5 or greater)

  1. Create a Sparebundle to copy to your NFS/SMB/AFP volume
    hdiutil create -size $SIZEg -fs HFS+J -type SPARSEBUNDLE -volname “Backup of $MACHINENAME” $MACHINENAME_$MACADDRESS.sparsebundle
  2. Use ifconfig and sub in your $MACHINENAME_$MAC_ADRESS into the sparsebundle filename – Remove the ‘:’ chars
    e.g. 0018b31184dd
    Use hostname to get your machines hostname – Don’t use fqdn
    Size can be adjusted at a later date if required – g = gigabytes
  3. Copy the budle to the nfs volume
    cp -rp $MACHINENAME_$MACADDRESS.sparsebundle /Path/to/nfs
  4. Run the defaults command to turn on timemachine for unsupported volumes support (As normal user – don’t sudo)
    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
  5. Now go to your System Prefrences and choose time machine
    Choose your NFS/SMB/AFP volume as the timemachine disc

uit.sh Hits over 1000 Downloads !

Just thought I would pass on that my Ubuntu Iphone teathersing Shell Script has passed 1000 downloads.
Feels good to have people all over the world use your script πŸ™‚

Hope everyone that has downloaded it has enjoyed it as much as I have in the car on the way to work.

The iPhone in Tethering Mode
The iPhone in 'Tethering Mode'

To see my super high tech counter visit:
http://us.cooperlees.com/ to see the current count πŸ™‚

Ubuntu iPhone 3.0 Bluetooth Tethering with uit.sh

If you would like to use your iPhone 3.0 with your bluetooth capable Ubuntu 9.04 PC then uit.sh (Ubuntu Iphone Thethering) is for you. This script installs all required conf, allows you to enable and disable your iphone tethering and even uninstall the conf if you no longer need it. I do expect NetworkManager to eventually support this out of the box.

Thanks to http://xn--9bi.net/2009/06/17/tether…o-ubuntu-9-04/ blog post which assisted me in knowning what configuration was needed.

— Ubuntu iPhone Tethering (uit) Version 0.1 – Cooper Lees <me@cooperlees.com> —
Usage: ./uit.sh options
– This script will install, uninstall, enable and disable iPhone tethering with iPhone 3.0 Software.
– It has been tested on a upto date (patched) box as of 20090623.
– !! Be careful, this script will ask for your password to get root privledges to your system!

-h Show this message
-i Install required configuration
-u Uninstall required configuration
-c Connect Tethering
-d Disconnect Tethering
-m [] Set iPhone’s MAC Address (to /home/USERNAME/.uitrc)
-v Verbose

Install Guide:
Avaliable from: http://us.cooperlees.com/download.php?F=uit.sh.gz

– Inital installation requires an active Internet Connection to get required dependancies through apt-get. Current dependancies = ‘bluez-compat’
– Only the install requires you to sudo the script, other areas apropriately sudo where required.

Install Process:

  1. Open terminal
  2. wget http://us.cooperlees.com/download.php?F=uit.sh.gz
  3. gunzip uit.sh.gz
  4. chmod 755 uit.sh
  5. [OPTIONAL] Move the script into your sbin – ‘sudo mv uit.sh /usr/sbin’ (This will allow it to be in your PATH)
  6. Run ‘sudo uit.sh -i’ (You will need to have your iphone in discoverable mode with Bluetooth on)
  7. You will be notified if it all sucessfully installs.

Connect Process:
– Ensure Bluetooth is on and paired with your system (use the GNOME Bluetooth tool to pair). Also make sure Internet Tethering is on.

  1. uit.sh -c

– Once connected you will see the iPhone come up with a blue bar stating ‘Internet Tethering’ is activated.

Disconnect Process:
One command will disconnect from the iphone tethering – You should see the blue notification text dissapear.

  1. uit.sh -d

Uninstall Process:

  1. uit.sh -u

– This will remove conf from files and also make backup of files modified.

Hope you enjoy it as much as I am. Finding the bluetooth a little slow. But still very handy and good. Thanks Apple.