VPS测速安装speedtest-cli测试网速教程

speedtest-cli -h这个和之前介绍的Speedtest一键包功能类似,都是去speedtest测速。

工具开源地址:https://github.com/sivel/speedtest-cli

工具安装方法:

Installation

pip / easy_install

pip install speedtest-cli

or

easy_install speedtest-cli

Github

pip install git+https://github.com/sivel/speedtest-cli.git

or

git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install

Just download (Like the way it used to be)

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

or

curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

Usage

$ speedtest-cli -h
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
                     [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
                     [--csv-header] [--json] [--list] [--server SERVER]
                     [--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
                     [--timeout TIMEOUT] [--secure] [--no-pre-allocate]
                     [--version]

Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli

optional arguments:
  -h, --help            show this help message and exit
  --no-download         Do not perform download test
  --no-upload           Do not perform upload test
  --bytes               Display values in bytes instead of bits. Does not
                        affect the image generated by --share, nor output from
                        --json or --csv
  --share               Generate and provide a URL to the speedtest.net share
                        results image, not displayed with --csv
  --simple              Suppress verbose output, only show basic information
  --csv                 Suppress verbose output, only show basic information
                        in CSV format. Speeds listed in bit/s and not affected
                        by --bytes
  --csv-delimiter CSV_DELIMITER
                        Single character delimiter to use in CSV output.
                        Default ","
  --csv-header          Print CSV headers
  --json                Suppress verbose output, only show basic information
                        in JSON format. Speeds listed in bit/s and not
                        affected by --bytes
  --list                Display a list of speedtest.net servers sorted by
                        distance
  --server SERVER       Specify a server ID to test against. Can be supplied
                        multiple times
  --exclude EXCLUDE     Exclude a server from selection. Can be supplied
                        multiple times
  --mini MINI           URL of the Speedtest Mini server
  --source SOURCE       Source IP address to bind to
  --timeout TIMEOUT     HTTP timeout in seconds. Default 10
  --secure              Use HTTPS instead of HTTP when communicating with
                        speedtest.net operated servers
  --no-pre-allocate     Do not pre allocate upload data. Pre allocation is
                        enabled by default to improve upload performance. To
                        support systems with insufficient memory, use this
                        option to avoid a MemoryError
  --version             Show the version number and exit

Python API

See the wiki.

Inconsistency

It is not a goal of this application to be a reliable latency reporting tool.

Latency reported by this tool should not be relied on as a value indicative of ICMP style latency. It is a relative value used for determining the lowest latency server for performing the actual speed test against.

There is the potential for this tool to report results inconsistent with Speedtest.net. There are several concepts to be aware of that factor into the potential inconsistency:

  1. Speedtest.net has migrated to using pure socket tests instead of HTTP based tests
  2. This application is written in Python
  3. Different versions of Python will execute certain parts of the code faster than others
  4. CPU and Memory capacity and speed will play a large part in inconsistency between Speedtest.net and even other machines on the same network

Issues relating to inconsistencies will be closed as wontfix and without additional reason or context.

 

安装过程中,如果提示

-bash: pip: command not found

请先安装pip
CentOS
easy_install pip
Ubuntu
apt-get install python-pip

Speedtest一键包 可用于检测VPS网速带宽 vps测速

前面分享的VPS测试脚本虽然都带有网络测试脚本,不过测试到速度可能并非VPS的带宽大小到速度,因为测速节点可能不是你VPS最近到机房,那么速度肯定会受到影响,通过Speedtest脚本可以选择你VPS最近到机房测速,这样测出来到带宽大小和你机器实际带宽大小应该差不多。

一、环境准备

我们使用的工具名称叫做 Speedtest,基于Python2.7编写。

因此支持大部分主流的操作系统版本,比如CentOS、Debian 、Ubuntu等,只要有Python2.7就可以。

二、下载脚本并赋予权限

使用如下命令获取最新版本:

wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py

赋权:

chmod +x speedtest.py

三、运行测试

使用如下命令来运行测试脚本:

./speedtest.py

或者使用Python命令来执行脚本,原理都是相同的:

python speedtest.py

系统会自动判断你服务器所在位置,并找到最近的节点进行测速

四、手动设置测速节点

有时候我们并不满足于测试服务器的出入网带宽,还想测试下到中国的网络速度,那么我们可以使用 –server参数来指定节点。

节点的信息可以从下方网址找到:

http://www.speedtest.net/speedtest-servers-static.php

然后用 ctrl+F 搜索想要使用的节点地址,找到其中节点的id ,加在--server参数后面就可以了。

比如我想使用北京的节点,就可以直接搜索“Beijing”

这样就可以直接找到北京节点,比如我想用北京的联通网络,其id是5145,那我们就可以测试到北京联通的网络速度了。

 

文章转至VPS大学

功能更全的VPS测试脚本ZBench 支持中英文显示

之前都是用的bench做VPS性能测试,今天发现一个更帅的VPS测试脚本ZBench,支持中文和英文显示,分享一下。

中文版:

wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh

英文版:

wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench.sh && bash ZBench.sh