What is smoking?
Smokeping is an open source software for monitoring network status and stability (developed by the author of RRDTool). It can monitor network conditions such as delay, packet loss rate, BGP multi line and so on; Smokeping will send various types of test data packets to the target equipment and system, measure and record, and graphically display the network delay, so as to clearly judge the instant communication situation of the network;
It can be used to monitor the network status of Qunhui host and the operation status of multiple vps. It supports email alarm.
install
Install in Docker mode on Qunhui.
Search the registry for smoking, select the first Linux server / smoking, and select the latest version.
volume
In the docker folder, create a new folder and name it smokeping, and create two subdirectories in smokeping, named config and data respectively.
folder | Load path | remarks |
---|---|---|
/docker/smokeping/data | /data | Database and application data directory |
/docker/smokeping/config | /config | Profile directory |
port
Ports cannot conflict
Local port | Container port | type |
---|---|---|
8580 | 80 | TCP |
environment
variable | value |
---|---|
TZ | Set to Asia/Shanghai |
PGID | < GID > set to 1000 |
PUID | < uid > set to 1000 |
function
Enter http: / / Qunhui IP:8580 in the browser to see the main interface
configuration file
The configuration file is in the / docker / smoking / config directory. Once you know its purpose, you can easily modify it later
file | purpose |
---|---|
Alerts | Alarm settings |
Database | Sampling frequency setting |
General | General settings |
httpd.conf | Apache Web server settings |
pathnames | Path setting |
Presentation | template file |
Probes | Probe setup |
Slaves | In master-slave mode, the slave is set |
ssmtp.conf | Mail server settings |
Targets | Monitoring target setting |
Database
Open the smoking / config / database file and use the default value, that is, ping 20 times in 300 seconds (5 minutes)
Probes
Edit the smoking / config / probes file, change google.com in dns to baidu.com, and others are the default
Mail alarm
Step 1: edit ssmtp.conf
The configuration takes effect and the container needs to be restarted
Except for the password, it's all below 👇
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 Private password for mailbox settings 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
Lao Su uses mailbox 88, and the relevant parameters can be found in the settings
After setting, you can enter the container through the "terminal" for Email sending debugging, and enter ssmtp - V on the command line wbsu2003@hotmail.com , and then enter:
To: wbsu2003@hotmail.com From: wbsu2003@88.com Subject: alert <Enter twice> test123 <ctrl+D>
Go to your inbox to check your mail
Step 2: edit Alerts
Modify the red box
- to: mailbox receiving alarm, or user-defined script;
- from: the mailbox that sends the alarm information, that is, the mailbox set in ssmtp.conf in the previous step;
The following are the conditions for triggering the alarm
The lower setting is to trigger the alarm more easily. The actual application delay can be set at 200ms
*** Alerts *** to = wbsu2003@hotmail.com from = wbsu2003@88.com +rttdetect type = rtt pattern = <20,<20,<20,<20,<20,>20,>20,>20 comment = Delay more than 20 for 3 consecutive times +lossdetect type = loss pattern = ==0%,==0%,==0%,==0%,==0%,>0%,>0%,>0% comment = Sudden packet loss
Targets
Internet Sites are basically sites that we cannot access normally, so they need to be modified, otherwise there will be no data
Edit the smoking / config / targets file
Please make a backup before editing
The format is clear at a glance. It adopts a hierarchical structure, which is represented by +. For example, the first layer "+" and the second layer "+ +" can be added or modified by analogy
below 👇 This paragraph comes from https://wzfou.com/smokeping/ , but it is fine tuned according to the Probes and Alerts we set earlier
+ Other menu = Three network monitoring title = Monitoring statistics probe = FPing ++ dianxin menu = Telecom network monitoring title = Telecom network monitoring list host = /Other/dianxin/dianxin-bj /Other/dianxin/dianxin-hlj /Other/dianxin/dianxin-tj /Other/dianxin/dianxin-sc /Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz +++ dianxin-bj menu = Beijing Telecom title = Beijing Telecom host = 202.96.199.133 alerts = rttdetect,lossdetect +++ dianxin-hlj menu = Heilongjiang Telecom title = Heilongjiang Telecom host = 219.147.198.242 alerts = rttdetect,lossdetect +++ dianxin-tj menu = Tianjin Telecom title = Tianjin Telecom host = 219.150.32.132 alerts = rttdetect,lossdetect +++ dianxin-sc menu = Sichuan Telecom title = Sichuan Telecom host = 61.139.2.69 alerts = rttdetect,lossdetect +++ dianxin-sh menu = Shanghai Telecom title = Shanghai Telecom host = 116.228.111.118 alerts = rttdetect,lossdetect +++ dianxin-gz menu = Guangdong Telecom title = Guangdong Telecom host = 113.111.211.22 alerts = rttdetect,lossdetect ++ liantong menu = Unicom Network Monitoring title = Unicom network monitoring list host = /Other/liantong/liantong-bj /Other/liantong/liantong-hlj /Other/liantong/liantong-tj /Other/liantong/liantong-sc /Other/liantong/liantong-sh /Other/liantong/liantong-gz +++ liantong-bj menu = Beijing Unicom title = Beijing Unicom host = 61.135.169.121 alerts = rttdetect,lossdetect +++ liantong-hlj menu = Heilongjiang Unicom title = Heilongjiang Unicom host = 202.97.224.69 alerts = rttdetect,lossdetect +++ liantong-tj menu = Tianjin Unicom title = Tianjin Unicom host = 202.99.96.68 alerts = rttdetect,lossdetect +++ liantong-sc menu = Sichuan Unicom title = Sichuan Unicom host = 119.6.6.6 alerts = rttdetect,lossdetect +++ liantong-sh menu = Shanghai Unicom title = Shanghai Unicom host = 210.22.84.3 alerts = rttdetect,lossdetect +++ liantong-gz menu = Guangdong Unicom title = Guangdong Unicom host = 221.5.88.88 alerts = rttdetect,lossdetect ++ yidong menu = Mobile network monitoring title = Mobile network monitoring list host = /Other/yidong/yidong-bj /Other/yidong/yidong-hlj /Other/yidong/yidong-tj /Other/yidong/yidong-sc /Other/yidong/yidong-sh /Other/yidong/yidong-gz +++ yidong-bj menu = Beijing Mobile title = Beijing Mobile host = 221.130.33.52 alerts = rttdetect,lossdetect +++ yidong-hlj menu = Heilongjiang Mobile title = Heilongjiang Mobile host = 211.137.241.35 alerts = rttdetect,lossdetect +++ yidong-tj menu = Tianjin Mobile title = Tianjin Mobile host = 211.137.160.5 alerts = rttdetect,lossdetect +++ yidong-sc menu = Sichuan Mobile title = Sichuan Mobile host = 218.201.4.3 alerts = rttdetect,lossdetect +++ yidong-sh menu = Shanghai Mobile title = Shanghai Mobile host = 117.131.19.23 alerts = rttdetect,lossdetect +++ yidong-gz menu = Guangdong Mobile title = Guangdong Mobile host = 211.136.192.6 alerts = rttdetect,lossdetect
Because there is Chinese, use utf-8 format
The configuration takes effect and the container needs to be restarted
If it is saved with the default GB18030 code, the Chinese will be garbled
The normal display should be like this
Over time, data will be generated gradually
When the set delay (rttdetect) or packet loss (lossdetect) condition is triggered, an email reminder will be received
If there is a problem with mail settings, a dead.letter file will be generated in the config directory to record triggered alarms
After downloading, open the file with the following contents 👇 In this way
Reference documents
oetiker/SmokePing: The Active Monitoring System
Address: https://github.com/oetiker/SmokePing
SmokePing - About SmokePing
Address: https://oss.oetiker.ch/smokeping/
How to install SmokePing – sleeplessbeastie's notes
Address: https://sleeplessbeastie.eu/2020/06/19/how-to-install-smokeping/
Smokeping installation and configuration - free and open source network performance monitoring tool visual master / slave deployment - dig station no - dig the fun of building a station
Address: https://wzfou.com/smokeping/
ssmtp - send mail from the command line | Hom
Address: https://gohom.win/2016/10/07/ssmtp/