Como posso produzir resultados iperf apenas para Interval and Bandwidth?

1

Estou tentando obter a saída do comando

iperf -c 10.0.0.1 -t 3600 -i 2

E só precisa dos campos Intervalo e largura de banda listados para toda a hora de registro.

Eu não usei grep ou awk anos após anos.

A ajuda seria incrível!

Exemplo de saída:

------------------------------------------------------------
Client connecting to node2, TCP port 5001
TCP window size:  129 KByte (WARNING: requested  130 KByte)
------------------------------------------------------------
[  3] local <IP Addr node1> port 2530 connected with <IP Addr node2> port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  19.7 MBytes  15.8 Mbits/sec

Saída desejada:

0.0-10.0 15.8
    
por Gutsygibbon 10.05.2018 / 19:39

2 respostas

3
> iperf -c 127.0.0.1 -t 2 -i 0.5 -f m | tee log1
------------------------------------------------------------
Client connecting to 127.0.0.1, TCP port 5001
TCP window size: 2.50 MByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 42200 connected with 127.0.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 0.5 sec   449 MBytes  7537 Mbits/sec
[  3]  0.5- 1.0 sec   578 MBytes  9697 Mbits/sec
[  3]  1.0- 1.5 sec   575 MBytes  9649 Mbits/sec
[  3]  1.5- 2.0 sec   587 MBytes  9848 Mbits/sec
[  3]  0.0- 2.0 sec  2190 MBytes  9183 Mbits/sec
> awk -F'[ -]+' '/sec/{print $3"-"$4" "$8}' log1
0.0-0.5 7537
0.5-1.0 9697
1.0-1.5 9649
1.5-2.0 9848
0.0-2.0 9183
> iperf -c 127.0.0.1 -t 2 -i 0.5 -f m |\
> awk -Wi -F'[ -]+' '/sec/{print $3"-"$4" "$8}'
# interactive results follow #
> iperf -c 127.0.0.1 -t 2 -i 0.5 -xc -yc | tee log2
20180515044354,,,,,3,0.0-0.5,536084480,8577351680
20180515044355,,,,,3,0.5-1.0,602537984,9640607744
20180515044355,,,,,3,1.0-1.5,621805568,9948889088
20180515044356,,,,,3,1.5-2.0,620888064,9934209024
20180515044356,,,,,3,0.0-2.0,2381447168,9524874284
> awk -F, '{print $7" "$9/1e6}' log2
0.0-0.5 8577.35
0.5-1.0 9640.61
1.0-1.5 9948.89
1.5-2.0 9934.21
0.0-2.0 9524.87
> iperf -c 127.0.0.1 -t 2 -i 0.5 -xc -yc | awk -Wi -F, '{print $7" "$9/1e6}'
# interactive results follow #
    
por 15.05.2018 / 03:56
-2

Se você está usando o iperf2 você pode querer experimentar a opção de formatação -yC

[root @ localhost iperf2-code] # src / iperf -c 192.168.1.4 -i 1 -yC -t 5 20180510151943,192.168.1.1,42090,192.168.1.4,5001,3,0.0-1,0,63438848,507510784 20180510151944,192.168.1.1,42090,192.168.1.4,5001,3,1.0-2.0,63569920,508559360 20180510151945,192.168.1.1,42090,192.168.1.4,5001,3,2.0-3,0,57802752,462422016 20180510151946,192.168.1.1,42090,192.168.1.4,5001,3,3,0-4,0,57409536,459276288 20180510151947,192.168.1.1,42090,192.168.1.4,5001,3,4.0-5.0,57016320,456130560 20180510151947,192.168.1.1,42090,192.168.1.4,5001,3,0.0-5,0,299237376,478429304

Bob

    
por 11.05.2018 / 00:20