I will use qperf: https://docs.oracle.com/cd/E86824_01/html/E54763/qperf-1.html
You can check a detailed example here: https://access.redhat.com/solutions/2122681
In destination machine you need to run the following command:
qperf &
You need to open ports 19765 and 19766 in this machine.
In source machine you need to create the following script, in my case, network-monitoring.sh:
#!/bin/sh echo "$(date +'%Y/%m/%d %H:%M:%S') comprobando red" HOSTNAME=$(hostname) DESTINO=[destinationMachine] ANCHO_BANDA=$(qperf -v -ip 19766 -t 5 --use_bits_per_sec $DESTINO tcp_bw | grep bw | awk '{print $3";"$4}' | sed -n '2 p') LATENCIA=$(qperf -v -ip 19766 -t 5 --use_bits_per_sec $DESTINO tcp_lat | grep latency | awk '{print $3";"$4}') echo "$(date +'%d/%m/%Y');$(date +'%H:%M:%S');$HOSTNAME;$DESTINO;$ANCHO_BANDA;$LATENCIA" >> /root/network-monitoring.csv