服务器network测试
node与pod直接的ping耗时测试 ping ipxx.xx.xx.xx
nohup ping -c 360s ipxx.xx.xx.xx 2>&1|tee c1node4pingnode2.log & -c指定ping的时长如3分钟为360s
格式如下
64 bytes from ipxx.xx.xx.xx: icmp_seq=161 ttl=64 time=0.129 ms
64 bytes from ipxx.xx.xx.xx: icmp_seq=162 ttl=64 time=0.141 ms
64 bytes from ipxx.xx.xx.xx: icmp_seq=163 ttl=64 time=0.153 ms
nohup跑完后为
[3]+ Done nohup ping -c 360s ipxx.xx.xx.xx 2>&1 | tee c1node4pingnode2.log
需要取得数据为最后一列的平均耗时
# cat 1.log |awk -F 'time=' '{print $2}'|awk -F ' ms' '{print $1}'|sed 's/$/,/g'
0.142,
0.129,
0.141,
0.153,
# cat c1node4pingnode2.log |awk -F 'time=' '{print $2}'|awk -F ' ms' '{print $1}'|awk '{sum+=$1}END{print "Average = ", sum/NR}'
如遇错误,停掉进程
ps -ef|grep ping|awk '{print $2}'|xargs kill -9
[1]+ Killed nohup ping -c 360s ipxx.xx.xx.xx 2>&1 | tee c3pod4pingpod2.log