2
1

More than 5 years have passed since last update.

iperfの出力をCSV化する方法

Posted at

ipef

お馴染みネットワークテストツール。
現在2系統のverがサポートされています。
iperf

  • ver2系
macOS
brew install iperf
ubuntu16.04
sudo apt install iperf
  • ver3系
macOS
brew install iperf
ubuntu16.04
sudo apt install iperf

コマンド

  • ver2系
-yc
~/
iperf -c サーバーのIP -u -i 1 -yc                                                                                                  [~]

20161006082657,192.168.0.3,65472,サーバーのIP,5001,4,0.0-1.0,132300,1058400
20161006082658,192.168.0.3,65472,サーバーのIP,5001,4,1.0-2.0,130830,1046640
20161006082659,192.168.0.3,65472,サーバーのIP,5001,4,0.0-2.3,296940,1047658
20161006082659,サーバーのIP,5001,192.168.0.3,65472,4,0.0-2.3,296940,1048896,1.547,0,202,0.000,0

こんな感じでCSVフォーマットで標準出力してくれます。

  • ver3系

ver3系ではCSV出力の機能がオミットされました。
代わりにJSONで吐き出すコマンドが実装されました。何も消すコト無いのに...

-J

ちなみにCSVで出力してくれるpythonのスクリプトが公式に落ちてました。
が、これはサーバーのログを出力するスクリプトっぽいので上の用途とは異なります。
iperf3protect
ちなみにこんな感じになります。

ubuntu16.04
yas-nyan:~$ iperf3 -s -J | python -u iperf3tocsv.py
date,ip,localport,remoteport,duration,protocol,num_streams,cookie,sent,sent_mbps,rcvd,rcvd_mbps,totalsent,totalreceived
"Wed, 05 Oct 2016 23:45:35 GMT",クライアントのIPアドレスだよ,5201,58957,5,TCP,1,MacBook-Air.local.くっきーだよ,0,0,43813584,69.9104,0,43813584

気が向いたらクライアント側でいい感じにCSV化してくれるスクリプトを書きます。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1