[![img](https://cdn.jsdelivr.net/gh/love2wind/cloudimg/img/88ab78543756a25051f1a1f838b1dd25.jpeg)](https://www.mrkevin.net/wp-content/uploads/2019/05/0076lr2Tgy1fs66oz1flwj33vc2kwhdv.jpg)

平时测试VPS的时候,总是要找各种各样的脚本,所以就想做个合集,方便一下自己……

I.综合测试脚本

※这类脚本是综合测试VPS基础信息、硬盘IO、带宽和网络延迟等项目的一键式脚本,主要有以下几个

1、秋水逸冰大佬的Bench.sh脚本

特点:

  1. 显示当前测试的各种系统信息;
  2. 取自世界多处的知名数据中心的测试点,下载测试比较全面;
  3. 支持 IPv6 下载测速;
  4. IO 测试三次,并显示平均值。

使用:

1
2
3
4
5
6
7
wget -qO- bench.sh | bash
#或者
curl -Lso- bench.sh | bash
#或者
wget -qO- 86.re/bench.sh | bash
#或者
curl -so- 86.re/bench.sh | bash

Github地址:https://github.com/teddysun/across/blob/master/bench.sh

Demo示例:

img

2、老鬼大佬的SuperBench测试脚本

这个脚本是在基于秋水大佬脚本的基础上,加入了独服通电时间,服务器虚拟化架构等内容

特点:

  1. 改进了显示的模式,基本参数添加了颜色,方面区分与查找。
  2. I/O测试,更改了原来默认的测试的内容,采用小文件,中等文件,大文件,分别测试IO性能,然后取平均值。
  3. 速度测试替换成了 Superspeed 里面的测试,第一个默认节点是,Speedtest 默认,其他分别测试到中国电信,联通,移动,各三个不同地区的速度。

使用方法

1
2
3
wget -qO- --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash
#或者
curl -Lso- -no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash

演示图

img

Github:https://github.com/oooldking/script/blob/master/superbench.sh

3、Zbench

脚本由漏水和kirito,基于Oldking大佬 的 SuperBench,然后加入Ping以及路由测试的功能,还能生成测评报告,分享给其他人查看测评数据

使用方法

1
2
3
4
#中文版
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

Demo

img

演示地址:https://www.zhujiboke.com/zbench-example.html

4、LemonBench

LemonBench工具(别名LBench、柠檬Bench),是一款针对Linux服务器设计的服务器性能测试工具。通过综合测试,可以快速评估服务器的综合性能,为使用者提供服务器硬件配置信息。

使用方法

1
2
3
curl -fsSL https://ilemonrain.com/download/shell/LemonBench.sh | bash
#或者
wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash

[post id=”2086”][/post]

II.内存检测脚本

检测VPS真实可分配内存的小工具,适用于检测VPS超售情况。本程序检测的可分配内存指的是用户使用时最大能占用的内存量。

使用方法

1
2
3
4
5
6
7
8
9
10
11
12
#CentOS / RHEL
yum install wget -y
yum groupinstall "Development Tools" -y
wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
gcc -l stdc++ memtester.cpp
./a.out
#Ubuntu / Debian
apt-get update
apt-get install wget build-essential -y
wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
gcc -l stdc++ memtester.cpp
./a.out

III.UnixBench测试脚本

UnixBench是一个类unix系(Unix,BSD,Linux)统下的性能测试工具,一个开源工具,被广泛用与测试linux系统主机的性能。Unixbench的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C库等系统基准性能提供测试数据。

使用方法

1
2
3
wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh
chmod +x unixbench.sh
./unixbench.sh

IV.带宽测试

SpeedTest是用来测试网络上传/下载速率的一款工具,在Windows上能很方便的测试本地网络的上传/下载速率,而在Linux上,也可以很方便的使用命令行SpeedTest来测试。

SpeedTest是用Python编写的轻量级Linux命令行工具,在Python2.4至3.4版本下均可运行,一般我都是用SpeedTest来测试VPS的带宽,以下内容仅做个记录,毕竟我老是忘记应该打什么代码……(大佬勿喷)

下载:

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

添加权限

1
chmod a+rx speedtest.py

现在就已经能使用了,最简单的使用方法

1
python speedtest.py

如果你想生成一张图片,并分享给其他人,那么应该这样:

1
python speedtest.py --share

在默认情况下,SpeedTest是选择离测试机最近的一个节点进行测试的,如果你想要自定义测试到某个地区的上传/下载速率,那首先列出目前可用的SpeedTest服务器:

1
python speedtest.py --list

此时会列出所有的服务器(按照距离远近进行排列)

如果想一点一点的列出服务器,请输入:

1
python speedtest.py --list|more

我们可以看到,列出的服务器前面有一串数字

1
2
3
4
5
6
7
8
9
10
11
12
13
root@debian:~# python speedtest.py --list|more
Retrieving speedtest.net configuration...
14939) Mimosa Networks (San Jose, CA, United States) [0.45 km]
10384) Speedtest.net (San Jose, CA, United States) [4.19 km]
11899) Janus Networks (San Jose, CA, United States) [4.19 km]
15786) Sprint (San Jose, CA, United States) [4.19 km]
9383) Sneaker Server (San Jose, CA, United States) [4.19 km]
9540) DNASOLES (San Jose, CA, United States) [4.19 km]
11599) Mimosa Networks (Santa Clara, CA, United States) [7.10 km]
18007) T-Mobile (Santa Clara, CA, United States) [7.10 km]
12818) Ridge Wireless (Cupertino, CA, United States) [12.57 km]
10455) Cytranet (Fremont, CA, United States) [24.84 km]
6468) Tekify Broadband Internet Services (Fremont, CA, United States) [24.84 km]

如果你想列出指定地区的测试节点,可以使用

1
python speedtest.py --list | grep China

如果我们想测试主机到Mimosa Networks这个节点的速率,那么是这样输入:

1
python speedtest.py --server 11599

如果是要生成分享的图片,那就加上share

1
python speedtest.py --server 11599 --share

是不是很简单……嗯……没错,没什么技术含量

V.Ping值测试

uPing-一个24小时监测VPS延迟的工具

依赖安装

1
2
3
4
5
#Debian / Ubuntu
apt-get update
apt-get install python wget screen -y
#CentOS / RHEL
yum install screen wget python -y

使用方法

1
2
3
screen -S uping
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/uPing/master/uping.py
python uping.py

Demo

img

VI.回程路由测试

从你的 Linux(X86/ARM)/Mac/BSD 系统环境下发起 traceroute 请求,附带链路可视化,兼容性更好,支持 JSON 格式

1
2
3
4
5
6
#下载
https://cdn.ipip.net/17mon/besttrace4linux.zip
#解压
unzip besttrace4linux.zip
#使用
./besttrace -q 1 这里是目标IP