If I use iperf with -y C and -r arguments to test bidirectional transfer and export it as a CSV.
I get some output but the problem is that I don't know what the column names are. For example it shows three rows of data but I don't know which corresponds to send and which to receive.
The other columns I can guess, but I would rather be sure.
I can't find this documented anywhere!
The fields are
timestamp,source_address,source_port,destination_address,destination_port,interval,transferred_bytes,bits_per_second
I deduced this by looking at
EDIT: You can find the relevant source code here:
date and time, source IP, source port, destination IP, destination port, iperf process number, time interval, amount of data transferred (bytes), bandwidth (bits per second), jitter (milliseconds), number of lost datagrams, total number of datagrams sent, percentage loss, number of datagrams received out of order
I got the above information from:
http://www.jb.man.ac.uk/~jcullen/code/python/iperf_tests.py
The accepted answer skips one odd field: the one that comes after the source and destination IP+port pairs:
The code in the accepted answer says this comes from the
transferID
variable. Some of the other answers here seem to argue that it represents a connection identifier or connection direction. However, a quick dive through the code indicates thattransferID
comes from a global variable namedgroupID
. It is initialized to zero:However, a quick grep through the code seems to indicate that it is incremented and decremented a lot, very confusingly. There don't seem to be any defined constants that say what it means. Manual testing (
iperf version 2.0.9 (9 Sept 2016) pthreads
) shows the number being reused between connections. So I guess the moral of the story is... ignore that number? Or use iperf3.Look at the 6th field assuming "," (comma) being a field separator. Then look at these lines here:
[ 5] local 127.0.0.1 port 54401 connected with 127.0.0.1 port 5001 [ 4] local 127.0.0.1 port 5001 connected with 127.0.0.1 port 54401 [ ID] Interval Transfer Bandwidth [ 5] 0.0-10.0 sec 50.3 GBytes 43.2 Gbits/sec [ 4] 0.0-10.0 sec 50.3 GBytes 43.2 Gbits/sec
"5" indicates client -> server connection, then "4" indicates "server -> client" connection (look at the source/destination ports to tell, in this particular example given by "sciurus".
Here is a simple demo using the CSV values and running in a loop checking for a given bps being met.
I also found there is an extra field present from the answers above which is 3/4/5 in value. 4 and 5 seem to be direction. 3 I'm not sure what it means. Anyway, in case this helps: