Rakhee Tiwari
Rakhee Tiwari

Reputation: 31

How to save Iperf result in an output file

I am running iperf between a set of hosts that are read from a txt file, here's how I am running it:

h1,h2 = net.getNodeByName(node_id_1, node_id_2)

net.iperf((h1, h2))

It runs well and displays the results. But, I want to save the output of iperf result in a separate txt file. Does anyone know how I can apply it on the above code?

Upvotes: 3

Views: 48869

Answers (7)

K.Vladimir
K.Vladimir

Reputation: 1

If you need to save a file in the txt format. On the client machine run cmd(adm) and after that you need to write this:

cd c:\iperf3
iperf3.exe -c "you server address"  -p "port"  -P 10 -w 32000 -t 0 >> c:\iperf3\text.txt

(-t 0) - infinity On the client machine, you will see a black screen in cmd. It's normal. You will see all the process in the server machine. After your test, on the client machine in cmd need push ctrl+ c and after (y). Your file in directory c:\iperf3\text.txt after that collect all information about this period. If you push close in cmd this file text.txt will be empty.

Recommended open this file in NotePad or WordPad for the correct view.

Upvotes: 0

Sanober Sayyed
Sanober Sayyed

Reputation: 182

Server

iperf3 -s -p <port> -B <IP> >> <filename> &

Client

iperf3  -p <port>  -c <server_ip> -B <client_ip> -t 5 >> <filename>

Make sure you kill the iperf process on the server when done

Upvotes: 1

tgudtk
tgudtk

Reputation: 39

Since you are running it on python, another method to save the result is to use popen:

popen( '<command> > <filename>', shell=True)

For example:

popen('iperf -s -u -i 1 > outtest.txt', shell=True)

You can check this for further information:

https://github.com/mininet/mininet/wiki/Introduction-to-Mininet#popen

Upvotes: 0

Anamort
Anamort

Reputation: 341

I think the answer is given by Chiara Contoli in here: iperf result in output file

In summary:

h1.cmd('iperf -s > server_output.txt &')
h2.cmd('iperf -t 5 -c ', h1.IP() + '  >  client_output.txt &')

Upvotes: 1

Paolo
Paolo

Reputation: 17

Do you already try:

--output test.log

(in newer versions --logfile)

or using

youriperfexpr > test.log

Upvotes: 2

user3107629
user3107629

Reputation: 21

In order to store the results of iperf test in a file , add | tee followed by the filename.txt to your command line for example :

iperf -c ipaddress -u -t 10 -i 1 | tee result.txt

Upvotes: 2

K.S.
K.S.

Reputation: 3199

I had this problem as well. Although the manpage specifies "-o" or "--output" to save your output to a file, this does not actually work.

It seems that this was marked as "WontFix": https://code.google.com/p/iperf/issues/detail?id=24:

Looks like -o/--output existed in a previous version but in not in the current version. The consensus in yesterday's meeting was that if --output existed then we should fix it, otherwise people should just use shell redirection and we'll mark this WontFix. So, WontFix.

So maybe just use typescript or ">test.log" as suggested by Paolo

Upvotes: 1

Related Questions