How to save Iperf result in output file

I run iperf between a set of hosts that are read from a txt file, this is how I run it:

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

net.iperf((h1, h2))

      

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

+3


source to share


6 answers


Have you already tried:

- output of test.log

(in new versions --logfile

)



or using

youriperfexpr> test.log

+1


source


I had this problem too. Although the manpage specifies "-o" or "--output" to save your output to a file, it doesn't actually work.

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



It looks like the -o / - output existed in the previous version, but not in the current version. The consensus in yesterday's meeting was that if --output exists, then we have to 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

+1


source


To save the iperf test results to a file, add | tee followed by filename.txt, for example:

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

+1


source


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

In short:

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

      

+1


source


Since you are using it in python, another way to store the result is using popen:

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

      

For example:

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

      

You can check this for more information:

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

0


source


If you need to save the file in TXT format. Run cmd (adm) on the client machine and after that you need to write the following:

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

(-t 0) - infinity On the client computer, you will see a black screen in cmd. This is normal. You will see the whole process on the server. After the test on the client machine in cmd, you need to press ctrl + c and after (y). Your file in the c: \ iperf3 \ text.txt directory will then collect all information about this period. If you hit close in cmd this text.txt file will be empty.

It is recommended that you open this file in Notepad or WordPad for correct viewing.

0


source







All Articles