标签:linux下测试网速
Speedtest是用来测试网络性能的开源软件,在Linux下面安装Speedtest可以用来测试网络出口的上传和下载速度,帮助排查网络方面导致的故障。
apt install python-pip
pip install speedtest-cli
which speedtest-cli | bash -
github安装
pip install git+https://github.com/sivel/speedtest-cli.git
或者
git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install
shell安装
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli
./speedtest-cli
speedtest-cli使用
speedtest-cli –h
/usr/bin/speedtest-cli –share
/usr/bin/speedtest-cli –list
具体过程如下:---------------------------------------------------------------------------
root@zabbix:/home/zj131# apt install python-pip Reading package lists... Done Building dependency tree... 0% Building dependency tree Reading state information... Done The following additional packages will be installed: libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev python-all python-all-dev python-dev python-pip-whl python-setuptools python-wheel python2.7-dev Suggested packages: python-setuptools-doc The following NEW packages will be installed: libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev python-all python-all-dev python-dev python-pip python-pip-whl python-setuptools python-wheel python2.7-dev 0 upgraded, 12 newly installed, 0 to remove and 146 not upgraded. Need to get 29.7 MB of archives. After this operation, 44.7 MB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libexpat1-dev amd64 2.1.0-7ubuntu0.16.04.3 [115 kB] Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-dev amd64 2.7.12-1ubuntu0~16.04.1 [27.8 MB] Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libpython-dev amd64 2.7.11-1 [7,728 B] Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libpython-all-dev amd64 2.7.11-1 [992 B] Get:5 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 python-all amd64 2.7.11-1 [978 B] Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-dev amd64 2.7.12-1ubuntu0~16.04.1 [276 kB] Get:7 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 python-dev amd64 2.7.11-1 [1,160 B] Get:8 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 python-all-dev amd64 2.7.11-1 [1,000 B] Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip-whl all 8.1.1-2ubuntu0.4 [1,110 kB] Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip all 8.1.1-2ubuntu0.4 [144 kB] Get:11 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 python-setuptools all 20.7.0-1 [169 kB] Get:12 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 python-wheel all 0.29.0-1 [48.0 kB] Fetched 29.7 MB in 1min 49s (272 kB/s) Selecting previously unselected package libexpat1-dev:amd64. (Reading database ... 107922 files and directories currently installed.) Preparing to unpack .../libexpat1-dev_2.1.0-7ubuntu0.16.04.3_amd64.deb ... Unpacking libexpat1-dev:amd64 (2.1.0-7ubuntu0.16.04.3) ... Selecting previously unselected package libpython2.7-dev:amd64. Preparing to unpack .../libpython2.7-dev_2.7.12-1ubuntu0~16.04.1_amd64.deb ... Unpacking libpython2.7-dev:amd64 (2.7.12-1ubuntu0~16.04.1) ... Selecting previously unselected package libpython-dev:amd64. Preparing to unpack .../libpython-dev_2.7.11-1_amd64.deb ... Unpacking libpython-dev:amd64 (2.7.11-1) ... Selecting previously unselected package libpython-all-dev:amd64. Preparing to unpack .../libpython-all-dev_2.7.11-1_amd64.deb ... Unpacking libpython-all-dev:amd64 (2.7.11-1) ... Selecting previously unselected package python-all. Preparing to unpack .../python-all_2.7.11-1_amd64.deb ... Unpacking python-all (2.7.11-1) ... Selecting previously unselected package python2.7-dev. Preparing to unpack .../python2.7-dev_2.7.12-1ubuntu0~16.04.1_amd64.deb ... Unpacking python2.7-dev (2.7.12-1ubuntu0~16.04.1) ... Selecting previously unselected package python-dev. Preparing to unpack .../python-dev_2.7.11-1_amd64.deb ... Unpacking python-dev (2.7.11-1) ... Selecting previously unselected package python-all-dev. Preparing to unpack .../python-all-dev_2.7.11-1_amd64.deb ... Unpacking python-all-dev (2.7.11-1) ... Selecting previously unselected package python-pip-whl. Preparing to unpack .../python-pip-whl_8.1.1-2ubuntu0.4_all.deb ... Unpacking python-pip-whl (8.1.1-2ubuntu0.4) ... Selecting previously unselected package python-pip. Preparing to unpack .../python-pip_8.1.1-2ubuntu0.4_all.deb ... Unpacking python-pip (8.1.1-2ubuntu0.4) ... Selecting previously unselected package python-setuptools. Preparing to unpack .../python-setuptools_20.7.0-1_all.deb ... Unpacking python-setuptools (20.7.0-1) ... Selecting previously unselected package python-wheel. Preparing to unpack .../python-wheel_0.29.0-1_all.deb ... Unpacking python-wheel (0.29.0-1) ... Processing triggers for man-db (2.7.5-1) ... Setting up libexpat1-dev:amd64 (2.1.0-7ubuntu0.16.04.3) ... Setting up libpython2.7-dev:amd64 (2.7.12-1ubuntu0~16.04.1) ... Setting up libpython-dev:amd64 (2.7.11-1) ... Setting up libpython-all-dev:amd64 (2.7.11-1) ... Setting up python-all (2.7.11-1) ... Setting up python2.7-dev (2.7.12-1ubuntu0~16.04.1) ... Setting up python-dev (2.7.11-1) ... Setting up python-all-dev (2.7.11-1) ... Setting up python-pip-whl (8.1.1-2ubuntu0.4) ... Setting up python-pip (8.1.1-2ubuntu0.4) ... Setting up python-setuptools (20.7.0-1) ... Setting up python-wheel (0.29.0-1) ... root@zabbix:/home/zj131# pip install speedtest-cli Collecting speedtest-cli Downloading speedtest_cli-1.0.7-py2.py3-none-any.whl Installing collected packages: speedtest-cli Successfully installed speedtest-cli-1.0.7 You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the ‘pip install --upgrade pip‘ command. root@zabbix:/home/zj131# which speedtest-cli | bash - Retrieving speedtest.net configuration... Testing from China Telecom Zhejiang (115.239.137.229)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by China Telecom (Shanghai) [159.30 km]: 35.873 ms Testing download speed................................................................................ Download: 14.60 Mbit/s Testing upload speed................................................................................................ Upload: 33.47 Mbit/s
root@zabbix:/home/zj131# which speedtest-cli /usr/local/bin/speedtest-cli root@zabbix:/home/zj131# /usr/local/bin/speedtest-cli --share Retrieving speedtest.net configuration... Testing from China Telecom Zhejiang (115.239.137.229)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by China Unicom (Nanjing) [283.73 km]: 42.266 ms Testing download speed................................................................................ Download: 42.97 Mbit/s Testing upload speed................................................................................................ Upload: 8.18 Mbit/s Share results: http://www.speedtest.net/result/6800539811.png
这个就是测试后的图片显示结果直接url访问
http://www.speedtest.net/result/6800539811.png
标签:linux下测试网速
原文地址:http://caimengzhi.blog.51cto.com/9787265/1982693