测试服务器配置,I/O,性能及网速,网络路由
测速脚本
wget -qO- sb.oldking.net | bash
wget -qO- bench.sh | bash
curl -sL yabs.sh | bash
综合测试
curl -LsO https://raw.githubusercontent.com/sayem314/serverreview-benchmark/master/bench.sh; chmod +x bench.sh && ./bench.sh -a share
回程路由
wget -qO- git.io/3trace | bash
./besttrace 127.0.0.1 -T #指定IP
或者
yum -y install traceroute
traceroute -q 1 ip #指定IP
或者
yum install mtr -y
mtr -z ip #指定IP
speedtest官方
官网
CENTOS
curl -s https://install.speedtest.net/app/cli/install.rpm.sh | bash
yum -y install speedtest
本地测试:speedtest
节点测试:speedtest -s 3633 #节点代码
安装好后删除repo
mv /etc/yum.repos.d/ookla_speedtest-cli.repo /etc/yum.repos.d/ookla_speedtest-cli.repo.b
DEBIAN
apt install lsb-release -y
wget -O /usr/share/keyrings/speedtest.asc https://packagecloud.io/ookla/speedtest-cli/gpgkey
echo "deb [signed-by=/usr/share/keyrings/speedtest.asc] https://packagecloud.io/ookla/speedtest-cli/debian/ buster main" > /etc/apt/sources.list.d/speedtest.list
apt update
apt install speedtest -y
iperf3官方
yum install iperf3 -y
iperf3 -s #服务端
iperf3 -c 0.0.0.0 -p 5201 -R #从服务端下载
iperf3 -c 0.0.0.0 -p 5201 #上传到服务端
iftop
依赖:
yum -y install flex byacc libpcap ncurses ncurses-devel libpcap-devel
yum -y install gcc
编译安装
wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make && make install
查看
iftop -n -P -b -i eth0
nload
yum -y install epel-release
如果epel-release无法安装
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
然后安装
yum -y install nload
nload device eth0
也可以编译安装
yum -y install gcc gcc-c++ ncurses-devel
wget http://www.roland-riegel.de/nload/nload-0.7.4.tar.gz
tar zxvf nload-0.7.4.tar.gz
cd nload-0.7.4
./configure
make && make install
vnstat
yum -y install epel-release
yum -y install vnstat
查看网卡
ip addr
创建监控数据库
vnstat -u -i eth0
添加权限
chmod 666 /var/lib/vnstat/eth0
chmod 666 /var/lib/vnstat/.eth0
开机启动
systemctl enable vnstat
systemctl start vnstat
systemctl stop vnstat
systemctl disable vnstat
流量查看
vnstat -l # 实时流量
vnstat -h # 小时
vnstat -d # 日流量
vnstat -w # 周流量
vnstat -m # 月流量
vnstat -t # 流量最高top10天
图片输出
/usr/bin/vnstati -d -o /root/day.png
需要带时间,新建sh
#!/bin/bash
date=$(date +%Y%m%d%H);/usr/bin/vnstati -d -o /usr/share/nginx/html/${date}.jpg
如果提示:Error: Interface "eth0" not available, exiting
修改/etc/vnstat.conf
文件
Interface "eth0"
改为实际网卡名称,重启systemctl start vnstat即可
高阶玩法点击