write in front
- I thought I would never use it again
smokeping
, but I was wrong.
- According to the last time I used it for about half a year, I usually use it once, and I will use it again this time, so I completely forgot about it.
then start
Install
apt-get -y install smokeping
configuration service
- For the configuration of the web server, refer to the previous article Running Shell Scripts with Nginx .
/etc/init.d/smokeping
It is recommended to keep the startup user configured in the detection service Nginx
consistent with, for www-data
example:
# /etc/init.d/smokeping
DAEMON_USER=www-data
- The effect of running out is roughly as follows:
Data configuration
- The page template
/etc/smokeping/basepage.html
, where the variables come from /etc/smokeping/config.d/General
.
- The data file is stored in
/etc/smokeping/config.d/pathnames
the path, remember to modify the directory permissions when changing the path.
# /etc/smokeping/config.d/pathnames
sendmail = /usr/sbin/sendmail
imgcache = /data/smokeping/htdocs/images
imgurl = images
datadir = /data/smokeping/libdata
piddir = /var/run/smokeping
smokemail = /etc/smokeping/smokemail
tmail = /etc/smokeping/tmail
- The referenced configuration is specified in the main configuration file
/etc/smokeping/config
, and the monitoring tasks of HTTP and Ping are added as follows:
# /etc/smokeping/config
@include /etc/smokeping/config.d/General
@include /etc/smokeping/config.d/Alerts
@include /etc/smokeping/config.d/Database
@include /etc/smokeping/config.d/Presentation
@include /etc/smokeping/config.d/Probes
@include /etc/smokeping/config.d/Slaves
@include /etc/smokeping/config.d/Targets
@include /etc/smokeping/config.d/HTTP
@include /etc/smokeping/config.d/Ping
- Add a Ping probe
/etc/smokeping/config.d/Ping
:
+ demo-intranet-fping
probe = FPing
menu = 核心机房Fping内网
title = 机房内网Ping
++ demo-bfs-01
menu = demo-bfs-01
title = demo-ops-lvs-02 -> 192.168.1.1
host = 192.168.1.1
++ demo-cache-01
menu = demo-cache-01
title = demo-ops-lvs-02 -> 192.168.1.5
host = 192.168.1.5
++ demo-k8s-master-01
menu = demo-k8s-master-01
title = demo-ops-lvs-02 -> 192.168.1.32
host = 192.168.1.32
- Add a standalone HTTP monitor,
/etc/smokeping/config.d/HTTP
:
+ kisjd-http-curl
probe = Curl
menu = 监控HTTP响应时间
title = 测试出网的HTTP访问速度
++ baidu
menu = baidu.com
title = www.baidu.com
host = www.baidu.com
++ bilibili
menu = bilibili.com
title = www.bilibili.com
host = www.bilibili.com
++ youku
menu = youku.com
title = www.youku.com
host = www.youku.com
++ iqiyi
menu = iqiyi.com
title = www.iqiyi.com
host = www.iqiyi.com
/etc/smokeping/config.d/Probes
The detection method is specified in the configuration file , example:
*** Probes ***
+ AnotherSSH
forks = 24
offset = 90%
greeting = SSH-2.0-OpenSSH_Smokeping
interval = complete
mininterval = 0.8
+ Curl
binary = /usr/bin/curl
forks = 24
offset = 90%
agent = User-Agent: Smokeping/2.6.9
expect = OK
extraargs = -4 --head
extrare = / /
follow_redirects = no
include_redirects = no
insecure_ssl = 1
interface = bond0
timeout = 20
urlformat = http://%host%/
+ FPing
binary = /usr/bin/fping
blazemode = true
hostinterval = 1.5
mininterval = 0.001
offset = 50%
packetsize = 5000
pings = 20
sourceaddress = 10.130.1.73
step = 300
timeout = 1.5
tos = 0x20
usestdout = true
- The default overview
/etc/smokeping/config.d/Presentation
is set in the configuration file, and the multi-dimensional data is added for reference as follows:
# /etc/smokeping/config.d/Presentation
*** Presentation ***
template = /etc/smokeping/basepage.html
charset = utf-8
+ charts
menu = 质量排行榜
title = 质量最差的排行榜
++ stddev
sorter = StdDev(entries=>4)
title = 响应时间方差排行 - top4
menu = 响应时间方差
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = 最大响应时间排行 - top5
menu = 最大响应时间
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = 稳定性最差的排行 - top5
menu = 稳定性
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = 平均响应时间最差的排行 - top5
menu = 平均响应时间
format = Median RTT %f seconds
+ overview
width = 800
height = 50
range = 24h
+ detail
width = 800
height = 200
unison_tolerance = 2
"Last 5 minutes" 5m
"Last 10 minutes" 10m
"Last 30 minutes" 30m
"Last 1 Hours" 1h
"Last 3 Hours" 3h
"Last 12 Hours" 12h
"Last 1 Days" 1d
"Last 7 Days" 7d
"Last 30 Days" 30d
- OK, the code is over. For reference when new installation