您的位置 首页 主机教程

网络性能监控工具Smokeping

SmokePing 是一款监控网络状态和稳定性的开源软件(它是 RRDTool 的作者开发的),通过它可以监控…

SmokePing 是一款监控网络状态和稳定性的开源软件(它是 RRDTool 的作者开发的),通过它可以监控如延时,丢包率,是否 BGP 多线等网络状况;smokeping 会向目标设备和系统发送各种类型的测试数据包,测量、记录,并通过图形化地展示网络的时延情况,进而能够清楚的判断出网络的即时通信情况。

可以用于监控群晖主机的网络状态,也可以用于监控多台 vps 的运行状态,支持通过邮件报警。

安装

在群晖上以 Docker 方式安装

在注册表中搜索 smokeping ,选择第一个 linuxserver/smokeping,版本选择 latest。
729063085
在 docker 文件夹中,创建一个新文件夹,并将其命名为 smokeping,并在 smokeping 中建两个子目录,分别命名为 config 和 data。
2096954167

文件夹 装载路径 备注
/docker/smokeping/data /data 数据库和应用数据目录
/docker/smokeping/config /config 配置文件目录

2609265774

端口可以自己设置,但是不能冲突

本地端口 容器端口 类型
8580 80 TCP

3412846127

环境配置

可变
TZ 设置为 Asia/Shanghai
PGID 设为 1000
PUID 设为 1000

2234441585

启动容器后在浏览器中输入 http://群晖IP:8580,就能看到主界面了
544630915

配置文件在 /docker/smokeping/config 目录中,知道了用途可以方便后面的修改

文件 用途
Alerts 报警设置
Database 采样频率设置
General 常规设置
httpd.conf Apache Web 服务器设置
pathnames 路径设置
Presentation 模板文件
Probes 探针设置
Slaves 主从模式时,从机设置
ssmtp.conf 邮件服务器设置
Targets 监控目标设置

602643503

在VPS上以 Docker 方式安装

1、更改服务器时间

timedatectl set-timezone Asia/Shanghai

2、一键脚本或者docker二选一安装就

bash -c "$(curl -L https://github.com/jiuqi9997/smokeping/raw/main/main.sh)"

脚本自动为 SmokePing 进行配置,可以自行按需修改。 SmokePing 主配置文件(包括目标节点)为/usr/local/smokeping/etc/config

安装docker

curl -fsSL https://get.docker.com | bash -s docker

复制执行以下代码

docker pull linuxserver/smokeping
docker run -d \
--name=smokeping \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 9080:80 \
-v /home/config/smokeping:/config \
-v /home/data/smokeping:/data \
--restart unless-stopped \
linuxserver/smokeping

以下配置均以群晖为教程,如果是VPS,请自行修改文件夹位置

Database采样频率设置

打开 smokeping/config/Database 文件,全部采用了默认值,也就是 300 秒(5 分钟)ping 20 次
3842513091

Probes探针设置

编辑 smokeping/config/Probes 文件,将 dns 中的 google.com 改为了 baidu.com,其他都是默认的。
1194345475

Targets监控目标设置

Internet Sites 基本上是我们正常无法访问的站点,所以需要进行修改,不然会没有数据
300869407
群晖路径smokeping/config/Targets,VPS路径 /home/config/smokeping/Targets
205296486
格式一目了然,采用了是分层结构,用+表示,例如第一层“+”,第二层“++”一次类推可以增加也可以修改
1624519102

下面附上三网节点,但根据我们前面设置的 Probes 和 Alerts进行了微调

节点代码
*** Targets ***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of WORKS Company. \
         Here you will learn all about the latency of our network.

+ Other
menu = 三大网络监控
title = 监控统计
 
++ CT
 
menu = 电信网络监控
title = 电信网络监控列表
host = /Other/CT/CT-BJ /Other/CT/CT-TJ /Other/CT/CT-HLJ /Other/CT/CT-SH /Other/CT/CT-SC /Other/CT/CT-GZ
 
+++ CT-BJ
 
menu = 北京电信
title = 北京电信
alerts = someloss
host = 202.96.199.133
 
+++ CT-TJ
 
menu = 天津电信
title = 天津电信
alerts = someloss
host = 219.150.32.132
 
+++ CT-HLJ
 
menu = 黑龙江电信
title = 黑龙江电信
alerts = someloss
host = 219.147.198.242
 
+++ CT-SH
 
menu = 上海电信
title = 上海电信
alerts = someloss
host = 180.153.28.5
 
+++ CT-SC
 
menu = 四川电信
title = 四川电信
alerts = someloss
host = 61.139.2.69
 
+++ CT-GZ
 
menu = 深圳电信
title = 深圳电信
alerts = someloss
host = 103.44.253.69
 
 
++ CU
 
menu = 联通网络监控
title = 联通网络监控列表
host = /Other/CU/CU-BJ /Other/CU/CU-TJ /Other/CU/CU-HLJ /Other/CU/CU-SH /Other/CU/CU-SC /Other/CU/CU-GZ
 
+++ CU-BJ
 
menu = 北京联通
title = 北京联通
alerts = someloss
host = 61.135.169.121
 
+++ CU-TJ
 
menu = 天津联通
title = 天津联通
alerts = someloss
host = 103.24.228.1
 
+++ CU-HLJ
 
menu = 黑龙江联通
title = 黑龙江联通
alerts = someloss
host = 202.97.224.69
 
+++ CU-SH
 
menu = 上海联通
title = 上海联通
alerts = someloss
host = 211.95.52.116
 
 
+++ CU-SC
 
menu = 四川联通
title = 四川联通
alerts = someloss
host = 119.6.6.6
 
+++ CU-GZ
 
menu = 广东联通
title = 广东联通
alerts = someloss
host = 221.5.88.88
 
 
 
++ CMCC
 
menu = 移动网络监控
title = 移动网络监控列表
host = /Other/CMCC/CMCC-BJ /Other/CMCC/CMCC-TJ /Other/CMCC/CMCC-HLJ /Other/CMCC/CMCC-SH /Other/CMCC/CMCC-SC /Other/CMCC/CMCC-GZ
 
+++ CMCC-BJ
 
menu = 北京移动
title = 北京移动
alerts = someloss
host = 221.130.33.52
 
+++ CMCC-TJ
 
menu = 天津移动
title = 天津移动
alerts = someloss
host = 211.137.160.5
 
+++ CMCC-HLJ
 
menu = 昆明移动
title = 昆明移动
alerts = someloss
host = 39.130.140.2
 
+++ CMCC-SH
 
menu = 上海移动
title = 上海移动
alerts = someloss
host = 221.183.55.22
 
+++ CMCC-SC
 
menu = 四川移动
title = 四川移动
alerts = someloss
host = 218.201.4.3
 
+++ CMCC-GZ
 
menu = 广东移动
title = 广东移动
alerts = someloss
host = 211.136.192.6

+ global
menu = 国际线路
title = 监控统计
host = /global/cf /global/yt /global/gg /global/sbd /global/cmi

++ cf

menu = Cloudflare
title = Cloudflare
alerts = someloss
host = www.cloudflare.com

++ yt

menu = YouTube
title = YouTube
alerts = someloss
host = www.youTube.com

++ gg

menu = google
title = google
alerts = someloss
host = www.google.com

++ sbd

menu = 美国斯巴达
title = 美国斯巴达
alerts = someloss
host = 45.154.214.42

++ cmi

menu = 香港CMI
title = 香港CMI
alerts = someloss
host = 117.18.13.248

因为有中文,要使用 utf-8 格式
3703481412

随着时间的推移,逐步会产生数据
3636747301

邮件报警

第一步、编辑 ssmtp.conf 配置生效需要重启容器
2869121338

除了密码都在下面

Debug=YES
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.

root=wbsu2003@88.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com

mailhub=smtp.88.com:465
AuthUser=wbsu2003@88.com
AuthPass=88邮箱设置的专用密码
UseSTARTTLS=NO

UseTLS=YES

# Where will the mail seem to come from?
rewriteDomain=88.com

# The full hostname
hostname=linuxserver-smokeping1

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

这里用的是 88 邮箱,相关参数可以在 设置 中找到
842437668

设置完成后,可以通过 『终端机』 进入容器内进行 Email 发送调试,命令行下输入 ssmtp -v wbsu2003@hotmail.com ,再依次输入:

To: wbsu2003@hotmail.com
From: wbsu2003@88.com
Subject: alert 

test123 

2048730564

去收件箱查看邮件
1118479239

第二步、编辑 Alerts
2567132265

修改红框部分

to:接收报警的邮箱,也可以是自定义脚本;
from:发送报警信息的邮箱,也就是上一步在 ssmtp.conf 中设置的邮箱;
下面是报警触发的条件
设的比较低是想更容易触发报警,实际应用延时可以设在 200ms

*** Alerts ***
to = wbsu2003@hotmail.com
from = wbsu2003@88.com
 
+rttdetect
type = rtt
pattern = <20,<20,<20,<20,20,>20,>20
comment = 连续3次延时20以上

+lossdetect
type = loss
pattern = ==0%,==0%,==0%,==0%,==0%,>0%,>0%,>0%
comment = 突然有丢包

3402161493

当触发了设定的延迟( rttdetect )或者丢包( lossdetect )条件时,会收到邮件提醒
3854286811

而如果邮件设置有问题,会在 config 目录中生成 dead.letter 文件,用于记录触发过的报警
922675683

下载之后打开文件内容是下面这样的
1007012762

参考文档
oetiker/SmokePing: The Active Monitoring System
地址:https://github.com/oetiker/SmokePing

SmokePing – About SmokePing
地址:https://oss.oetiker.ch/smokeping/

How to install SmokePing – sleeplessbeastie’s notes
地址:https://sleeplessbeastie.eu/2020/06/19/how-to-install-smokeping/

Smokeping安装与配置-免费开源网络性能监控工具可视化主/从部署 – 挖站否-挖掘建站的乐趣
地址:https://wzfou.com/smokeping/

老苏博客:https://blog.csdn.net/wbsu2004/article/details/120315178

本文来自网络,不代表45主机测评立场,转载请注明出处:https://45sp.com/2117.html

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

联系我们

联系我们

邮箱: reduu@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部