wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum -y install httpd httpd-devel gcc make curl wget
yum -y install libxml2-devel libpng-devel glib pango pango-devel \
freetype freetype-devel fontconfig cairo cairo-devel \
libart_lgpl libart_lgpl-devel
yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl
yum -y install perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI
yum -y install perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker
yum -y install perl-RRD-Simple rrdtool rrdtool-per
yum install mod_fcgid bind-utils -y
#下载安装包:
wget http://www.fping.org/dist/fping-3.10.tar.gz
wget https://fossies.org/linux/misc/old/echoping-6.0.2.tar.gz
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel popt popt-devel libidn libidn-devel -y
tar xf fping-3.10.tar.gz
cd fping-3.10
./configure
make && make install
tar xf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure
make && make install
tar xf smokeping-2.6.9.tar.gz
cd smokeping-2.6.9
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
出现报错:
Can’t locate Sys/Syslog.pm in @INC (@INC contains:
/usr/local/smokeping/thirdparty/lib/perl5/x86_64-linux-thread-multi
/usr/local/smokeping/thirdparty/lib/perl5 …/lib
/usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
/usr/lib64/perl5 /usr/share/perl5 .) at …/lib/Smokeping.pm line 16.
解决办法:
yum -y install perl-Sys-Syslog #缺包了,安装这个就OK
cd /usr/local/smokeping/
mkdir cache data var
touch /var/log/smokeping.log
chown apache:apache cache data var
chown apache:apache /var/log/smokeping.log
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
cd /usr/local/smokeping/htdocs
mv smokeping.fcgi.dist smokeping.fcgi
cd /usr/local/smokeping/etc
mv config.dist config
vi /usr/local/smokeping/etc/config
#修改如下内容:
cgiurl=http://你的ip/smokeping.cgi
*** Database ***
step = 300 此处建议改为 120 #刷新时间秒
vim /etc/httpd/conf/httpd.conf
#末尾添加如下内容:
Alias /cache "/usr/local/smokeping/cache/"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
DirectoryIndex smokeping.fcgi
#102行修改如下内容
Options Indexes FollowSymLinks
AllowOverride None
yum -y install wqy-zenhei-fonts.noarch #安装字体
vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
#在第147行,下边插入这一行代码
'--font TITLE:20:"WenQuanYi Zen Hei Mono"',
vi /usr/local/smokeping/etc/config
#第110更改fping的目录为
binary = /usr/local/sbin/fping
OK 现在可以打开页面了 http://ip/smokeping
vi /usr/local/smokeping/etc/config #编辑smokeping配置文件
#末尾添加:
+ gateway
menu = 网关
title = 网关(192.168.1.1)
host = 192.168.1.1
alerts = someloss
/usr/local/smokeping/bin/smokeping --config=/usr/local/smokeping/etc/config --logfile=/usr/local/smokeping/var/smokeping.log
systemctl restart httpd #重启服务
/usr/local/smokeping/bin/smokeping --restart