常用vps测试脚本/Linux软硬件测试脚本

这里有各种测试VPS硬件/网络/IO的脚本,比如:bench,Superbench,Zbench,LemonBench,etc,快来试试吧。

下面我们会在一台阿里云的4core 8G 2M的Centos 7.6的服务器上进行测试,即本站使用VPS。

Bench.sh

脚本运行

1
2
3
4
5
wget -qO- bench.sh | bash

# 或者

curl -Lso- bench.sh | bash

如果提示没有wget或者curl命令,使用yum install -y wget或者apt-get install -y wget即可。

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

还有其他的一些Teddysun大神写的脚本,在上级目录中。

特点:

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

缺点:

感觉耗时比较长。

截止博文时间最近的一次更新:2018年6月3日

结果截图:

SuperBench(推荐)

老鬼的测试脚本:https://www.oldking.net/350.html

下载地址:https://github.com/oooldking/script/blob/master/superbench.sh

使用方法:

1
2
3
4
5
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

特点:

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

截止博文时间最近的一次更新:2018.10.25 v1.1.3 增加TCP拥塞控制检测 最新的一次更新

本VPS测试结果:
· http://www.speedtest.net/result/8144104023.png
· https://paste.ubuntu.com/p/Jhh2FFvYQf/

结果截图:

Zbench

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

github地址:https://github.com/FunctionClub/ZBench

使用方法:

中文版:

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

英文版:

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

截止博文时间最近的一次更新:2018年6月31号

优点:

可以生成测试报告,见Demo测试地址:https://www.zhujiboke.com/zbench-example.html

缺点:

耗时比较久,建立使用screen

结果截图:

LemonBench(推荐)

由于LemonBench还在开发中,程序的功能可能会做适当添加与删除。 所以目前的版本品质仅供参考!LemonBench目前涵盖了如下测试:

  1. 服务器基础信息 (CPU信息/内存信息/Swap信息/磁盘空间信息等)
  2. Speedtest网速测试 (本地到最近源及国内各地域不同线路的网速)
  3. 磁盘测试 (4K块/1M块 直接写入测试)
  4. 路由追踪测试 (追踪到国内和海外不同线路的路由信息)
  5. Spoofer测试 (获取详细网络信息,快速判断服务器接入线路)
  6. LemonBench使用起来非常简单,只需要复制粘贴再来个回车就可以轻松启动测试。

使用方法:

1
curl -fsSL https://ilemonrain.com/download/shell/LemonBench.sh | bash

如果你的服务器上安装有 wget 工具,请使用以下命令执行脚本:

1
wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash

提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@imooc bench]# wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash -s [TestMode] -f

LBench 服务器测试工具 LemonBench Server Test Toolkit 20190206 BetaVersion

> 帮助文档 HelpDocument

使用方法 Usage :

(1) wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash -s [TestMode]
(2) curl -fsSL https://ilemonrain.com/download/shell/LemonBench.sh | bash -s [TestMode]

可选测试参数 Available Parameters :

-f, --fast, fast 执行快速测试
-F, --full, full 执行完整测试
spfast, --speedtest-fast 仅执行Speedtest网速测试 (快速测试)
spfast, --speedtest-fast 仅执行Speedtest网速测试 (完整测试)
dtfast, --disktest-fast 仅执行磁盘性能测试 (快速测试)
dtfast, --disktest-fast 仅执行磁盘性能测试 (完整测试)
btfast, --besttrace-fast 仅执行路由追踪测试 (快速测试)
btfast, --besttrace-full 仅执行路由追踪测试 (完整测试)
spf, --spoofer 仅执行Spoofer测试

使用快速测试:

1
wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash -s fast

结果截图:

UnixBench性能测试

也是TeddySun的作品。

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

使用方法:

1
2
3
4
5
6
7
8
# 下载脚本
wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh

# 给权限
chmod +x unixbench.sh

# 执行
./unixbench.sh

内存检测脚本

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

使用方法:

1
2
3
4
5
6
#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
1
2
3
4
5
6
#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

Linux中查看本机IP的方法

使用方法:

1
curl [下面的链接]

例如:

使用cip.cc:

1
2
3
4
5
6
7
8
9
10
[root@imooc ~]# curl cip.cc
IP : 47.105.212.161
地址 : 中国 山东 青岛
运营商 : 阿里云/电信/联通/移动/铁通/教育网

数据二 : 浙江省杭州市 | 阿里云

数据三 : 中国浙江省杭州市 | 阿里巴巴

URL : http://www.cip.cc/47.105.212.161

使用ipinfo.io:

1
2
3
4
5
6
7
8
9
10
11
[liwei@MBP ~]$ curl ipinfo.io
{
"ip": "173.242.117.48",
"hostname": "173.242.117.48.16clouds.com",
"city": "Los Angeles",
"region": "California",
"country": "US",
"loc": "34.0584,-118.2780",
"postal": "90017",
"org": "AS25820 IT7 Networks Inc"
}

使用ip.cn和ipip.net(不准):

1
2
3
4
5
[root@imooc ~]# curl https://ip.cn
当前 IP: 47.105.212.161 来自: 山东省青岛市 阿里云

[liwei@MBP ~]$ curl myip.ipip.net
当前 IP:173.242.117.48 来自于:美国 加利福尼亚州 洛杉矶 it7.net

几个网址也非常好记忆

Screen大法好

由于测试用时较长,为防止发生SSH断线意外,推荐放在screen中运行!**

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Centos中
yum install -y screen
# Debian & Ubuntu
apt-get install -y screen

# 创建screen会话
screen -S mytest

# 使用Ctrl + a d退出Screen会话,或者直接exit命令
# 返回screen
screen -r mytest

# screen 列表
screen -ls