测试环境 CentOS 7.8
安装依赖包
#yum install -y open-vm-tools
#yum install -y open-vm-tools-desktop
#yum update
#yum install -y net-tools ntp ntpdate
#yum install -y rrdtool perl-rrdtool openssl-devel
#yum install -y perl-core
安装smokeping
#cd /opt
#tar zxvf smokeping-2.7.3.tar.gz
#cd smokeping-2.7.3
#cp -r thirdparty /opt/smokeping/
#./configure --prefix=/opt/smokeping
#/usr/bin/gmake install
安装fping
#cd /opt
#tar zxvf fping-5.0.tar.gz -C /opt
# ./configure --prefix=/usr/local/fping
#make && make install
安装echoping
#cd /opt
#tar zxvf echoping-6.0.2.tar.gz
#cd echoping-6.0.2
#yum install -y popt-devel
# ./configure --prefix=/usr/local/echoping --with-ssl --without-libidn
#make && make install
#yum install -y dig-utils httpd httpd_devel
#vim /etc/httpd/conf/httpd.conf
将语句改为 ServerName localhost:80
#mkdir -p /var/www/smokeping/data
#mkdir /opt/smokeping/var
#mkdir /var/www/smokeping/cache
#cp -R /opt/smokeping/htdocs/* /var/www/smokeping
#mv /var/www/smokeping/smokeping.fcgi.dist /var/www/smokeping/smokeping.fcgi
#chown -R apache:apache /var/www/smokeping
#cp /opt/smokeping/etc/config.dist /opt/smokeping/etc/config
#chmod 600 /opt/smokeping/etc/smokeping_secrets.dist
安装Authen::SASL模块
#wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/Authen-SASL-2.12.tar.gz
#chmod a+x Authen-SASL-2.12.tar.gz
#tar zxvf Authen-SASL-2.12.tar.gz
#cd Authen-SASL-2.12
#perl Makefile.PL
#make test
#make install
修改配置文件
#vi /opt/smokeping/lib/Smokeping.pm
正文开头加入一行
use Authen::SASL;
定位到下述行 /sub sendmail
将表述改成 $smtp->auth(split(/\s*,\s*/, $cfg->{General}{mailusr}),split(/\s*,\s*/, $cfg->{General}{mailpwd}));
定位到下述行 /smokemail cgiurl
将表述改成 mailhost mailusr mailpwd
#vi /opt/smokeping/etc/config
*** General ***
owner = domain
contact = it@domain.com
mailhost = smtp.mxhichina.com
mailusr = it-log@domain.com
mailpwd = Genew@123
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
imgcache = /var/www/smokeping/cache
imgurl = cache
datadir = /var/www/smokeping/data
piddir = /opt/smokeping/var
cgiurl = http://10.8.1.35/smokeping.cgi
smokemail = /opt/smokeping/etc/smokemail.dist
tmail = /opt/smokeping/etc/tmail.dist
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
*** Alerts ***
to = user@domain.com
from = it-log@domain.net
+hostdown
type = loss
pattern = ==0%,==0%,==0%,==U
comment = no reply
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 60
pings = 20
# consfn mrhb steps total
AVERAGE 0.5 1 1008
AVERAGE 0.5 12 4320
MIN 0.5 12 4320
MAX 0.5 12 4320
AVERAGE 0.5 144 720
MAX 0.5 144 720
MIN 0.5 144 720
*** Presentation ***
charset = UTF-8
template = /opt/smokeping/etc/basepage.html.dist
htmltitle = yes
graphborders = no
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours" 3h
"Last 30 Hours" 30h
"Last 10 Days" 10d
"Last 400 Days" 400d
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
slave内容全删除
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Hello World!
+ Test
menu = Targets
title = VPN-Link
++ xian-50M
menu = test
title = test
alerts = someloss,hostdown
host = 1.1.1.1
Multihost内容全删除
--------------------
vim /usr/lib/systemd/system/smokeping.service
[Unit]
Description=Smokeping Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
ExecStart=/opt/smokeping/bin/smokeping --nodaemon --
config=/opt/smokeping/etc/config --
logfile=/var/log/smokeping.log
[Install]
WantedBy=multi-user.target
-----------------
vim /etc/httpd/conf.d/smokeping.conf
Alias /smokeping "/var/www/smokeping"
<Directory /var/www/smokeping>
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
AuthName "Smokeping"
AuthType Basic
AuthUserFile /opt/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>
创建admin账户
htpasswd -c /opt/smokeping/htdocs/htpasswd admin
重启服务及应用
#setenforce 0
#firewall-cmd --add-service=http
#firewall-cmd --add-service=https
#firewall-cmd --runtime-to-permanent
#setsebool -P httpd_can_network_connect 1
#systemctl start httpd && systemctl enable httpd
#systemctl start smokeping && systemctl enable smokeping