不同平台不同版本的iperf结果加时间戳

  • 背景

    常用iperf对网络通路进行带宽测试,当需要24小时不间断甚至更长时间的持续测试时,记录过程信息就非常有必要,可在网络出现问题时,根据日志来定位问题发生时段。

Iperf3增加时间戳信息-方法1

#iperf3 客户端服务器均可显示时间戳,iperf3 3.17以上版本支持
test:~$ iperf3  -s -i 1 --timestamp
Sat Jan 20 11:05:38 2024 -----------------------------------------------------------
Sat Jan 20 11:05:38 2024 Server listening on 5201
Sat Jan 20 11:05:38 2024 -----------------------------------------------------------
Sat Jan 20 11:05:41 2024 Accepted connection from 172.17.10.188, port 57090
Sat Jan 20 11:05:41 2024 [  5] local xxxIP port 5201 connected to xxxIP port 57104
Sat Jan 20 11:05:42 2024 [ ID] Interval           Transfer     Bitrate
Sat Jan 20 11:05:42 2024 [  5]   0.00-1.00   sec  6.97 GBytes  59.9 Gbits/sec                  
Sat Jan 20 11:05:43 2024 [  5]   1.00-2.00   sec  7.38 GBytes  63.4 Gbits/sec 

test:~$ iperf3 -c xxxIP -t 5555   -i 1 --timestamp
Sat Jan 20 11:05:10 2024 Connecting to host xxxIP, port 5201
Sat Jan 20 11:05:10 2024 [  5] local xxxIP port 59062 connected to xxxIP port 5201
Sat Jan 20 11:05:11 2024 [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
Sat Jan 20 11:05:11 2024 [  5]   0.00-1.00   sec  7.30 GBytes  62.7 Gbits/sec    0   2.06 MBytes       
Sat Jan 20 11:05:12 2024 [  5]   1.00-2.00   sec  7.34 GBytes  63.0 Gbits/sec    0   2.06 MBytes       
Sat Jan 20 11:05:13 2024 [  5]   2.00-3.00   sec  7.32 GBytes  62.9 Gbits/sec    0   2.06 MBytes 

Iperf3增加时间戳信息-方法2

#方法2, 使用-T参数,在iperf3客户端 上可用。
test:~$ iperf3 -c xxxIP -t 5555   -i 1 -T $(date "+%H:%M:%S ")
11:07:32:  Connecting to host xxxIP, port 5201
11:07:32:  [  5] local xxxIP port 53722 connected to xxxIP port 5201
11:07:32:  [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
11:07:32:  [  5]   0.00-1.00   sec  7.12 GBytes  61.2 Gbits/sec    0   1.69 MBytes       
11:07:32:  [  5]   1.00-2.00   sec  7.28 GBytes  62.5 Gbits/sec    0   1.75 MBytes       

Iperf2在windows平台下增加时间戳信息

说明: iperf -e 参数可显示更多信息。

#iperf2 windows
d:\AppGallery\iperf-2.0.9-win64\iperf.exe -s -u  -i 1  | Foreach{"{0}-{1}" -f (get-date),$_}
d:\AppGallery\iperf-2.0.9-win64\iperf.exe -c 127.0.0.1 -t 10000 -u -e -i 1 | Foreach{"{0}-{1}" -f (get-date),$_}

Iperf2在linux平台下增加时间戳信息

#iperf2 linux客户端
nohup iperf -c 127.0.0.1 -t 10000 -u -e -i 1 | while read pong; do echo "$(date +"%Y-%m-%d %H:%M:%S") | $pong"; done | tee -a iperf-$(date +"%Y-%m-%d-%H:%M:%S").log &

#iperf2 linux服务端 
nohup iperf -s -u -e -i 1 | while read pong; do echo "$(date +"%Y-%m-%d %H:%M:%S") | $pong"; done | tee -a iperf-$(date +"%Y-%m-%d-%H:%M:%S").log &
2024-01-20 11:15:01 | ------------------------------------------------------------
2024-01-20 11:15:01 | Server listening on UDP port 5001 with pid 145938
2024-01-20 11:15:01 | Read buffer size: 1.44 KByte (Dist bin width= 183 Byte)
2024-01-20 11:15:01 | UDP buffer size:  208 KByte (default)
2024-01-20 11:15:01 | ------------------------------------------------------------
2024-01-20 11:15:01 | [  1] local xxIP %eno1 port 5001 connected with 172.17.10.188 port 59705 (sock=3) (peer 2.1.5) on 2024-01-20 11:15:01 (CST)
2024-01-20 11:15:02 | [ ID] Interval            Transfer     Bandwidth        Jitter   Lost/Total  Latency avg/min/max/stdev PPS NetPwr
2024-01-20 11:15:02 | [  1] 0.0000-1.0000 sec   131 KBytes  1.07 Mbits/sec   0.001 ms 1439/1530 (94%) 0.005/0.001/0.039/0.006 ms 91 pps 26292
2024-01-20 11:15:03 | [  1] 1.0000-2.0000 sec   128 KBytes  1.05 Mbits/sec   0.001 ms 0/89 (0%) 0.005/0.003/0.023/0.004 ms 89 pps 26891

The End.


你可能感兴趣的:(得力工具,iperf,日志时间戳,网络带宽监测,iperf3)