centos7 smokeping总结
1.系统环境配置
防火墙设置
firewall-cmd --permanent --add-port 80/tcp
service firewalld restart
Selinux设置
vi /etc/sysconfig/selinux
改 Selinux=enable --> disabled
注:Selinux修改完之后需要重启机器才能生效
NTP时间同步
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate pool.ntp.org
可以写个定时任务,每天定时同步时间
crontab -e
0 0 * * * ntpdate pool.ntp.org
2.安装环境配置
yum -y update
yum -y install epel-release
yum -y install cpan
yum -y 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 perl-IO-Tty perl-FCGI perl-CGI perl-CGI-SpeedyCGI perl-Net-OpenSSH rrdtool-perl perl-Sys-Syslog 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-devel libidn-devel vim
3.smokeping、fping、echoping源码下载
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
wget http://www.fping.org/dist/fping-3.15.tar.gz
wget http://pkgs.fedoraproject.org/repo/pkgs/echoping/echoping-6.0.2.tar.gz/991478532b56ab3b6f46ea9fa332626f/echoping-6.0.2.tar.gz
4.编译fping
tar -xvf fping-3.15.tar.gz
cd fping-3.15
./configure
make
make install
5.编译echoping
tar -xvf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure
make
make install
6.编译smokeping
tar -xvf smokeping-2.6.11.tar.gz
cd smokeping-2.6.11
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
7.smokeping配置
cd /usr/local/smokeping/
mkdir cache data var mtr
touch /var/log/smokeping.log
chown apache:apache cache data var mtr
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
mkdir -p config.d/
8.config文件修改
cd /usr/local/smokeping/etc
vi config
修改
cgiurl = http://localhost/smokeping.cgi
step = 60
9.Apache设置
(1)登录密码认证
htpasswd -c /usr/local/smokeping/htdocs/htpasswd 用户名
密码自定义
(2)httpd配置修改(Apache2.4版本)
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"
<Directory "/usr/local/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
AuthName "Smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>
service httpd start
10.设置开机启动
vim /etc/rc.local
smokepid="/usr/local/smokeping/var/smokeping.pid"
if [ -f "smokepid"
fi
/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &
11.登录Web
网友评论