同时ping多个主机,找到最快的。
mping的Python项目详细描述
MPing
同时Ping多个主机并找到最快的
安装
pip3 install -U mping
用法
只需告诉哪个主机最快:
mping host1.com host2.com host3.com
从文件中获取主机,并对其执行ping操作:
mping -p PATH/TO/THE/FILE.txt
Read **Input File** section below for more details.
结果如下:
host | count, loss%, min/avg/max ----------|-------------------------- host1.com | 99, 0.0%, 5.4/6.8/14.1 host2.com | 90, 0.0%, 23.8/33.5/39.5 host3.com | 77, 0.4%, 37.4/39.1/43.6 The ``count`` number represents how many replies returned from each host.
还要查看帮助资料以了解更多说明:
mping -h
输入文件
可以使用纯文本文件或json文件作为-p/ --path参数。
纯文本文件
使用纯文本文件时,只需将每个主机放在一行中。
例如:
host1.com host2.com host3.com
json文件
您还可以使用json文件作为输入主机,下面是2 模式:
将主机放入列表:
json [ "host1.com", "host2.com", "host3.com" ]
或在具有名称的对象(dict)中:
json { "S1": "host1.com", "S2": "host3.com", "S3": "host3.com" }
The names will be printed in the results.