smokeping需要rrdtool,因此,先安装rrdtool
1、获取rrdtool:
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.5.4.tar.gz
2、解压
tar zxvf rrdtool-1.5.4.tar.gz
3、安装依赖
sudo yum -y install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel perl-devel
4、编译安装
sudo ./configure --prefix=/opt/rrdtool-1.6.0
sudo make && sudo make install
注意:出现如下报错是没有安装perl-devel依赖
Can‘t locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /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 Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.
make[2]: *** [perl-piped] 错误 2
make[2]: Leaving directory `/root/rrdtool-1.5.4/bindings‘
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/root/rrdtool-1.5.4/bindings‘
make: *** [all-recursive] 错误 1ech
安装依赖
sudo yum -y install perl-devel
5、重新安装
make clean
make
make install
rrdtool出图时中文乱码解决方法:
sudo yum install wqy-zenhei-fonts
cd /usr/share/fonts/
fc-cache -fv
6、下载somkeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
tar xf smokeping-2.6.11.tar.gz
7、安装smokeping的依赖
sudo yum install fping curl bind-utils perl rrdtool-perl -y
8、编译
./configure --prefix=/opt/smokeping
编译报错:
** Aborting Configure ******************************
If you know where perl can find the missing modules, set
the PERL5LIB environment variable accordingly.
FIRST though, make sure that ‘perl‘ starts the perl
binary you want to use for SmokePing.
Now you can install local copies of the missing modules
by running
./setup/build-perl-modules.sh /opt/smokeping/thirdparty #运行该命令,安装perl模块
The RRDs perl module is part of RRDtool. Either use the rrdtool
package provided by your OS or install rrdtool from source.
If you install from source, the RRDs module is located
PREFIX/lib/perl
9、安装perl模块
sudo ./setup/build-perl-modules.sh /opt/smokeping/thirdparty
10、重新编译
sudo ./configure --prefix=/opt/smokeping
11、安装
/usr/bin/gmake install
12、配置调整
a.创建cache、data、var目录
cd /opt/smokeping
sudo mkdir cache data var
b.在创建日志
sudo touch /var/log/smokeping.log
c.授权
sudo chown apache:apache cache data var
sudo chown apache:apache /var/log/smokeping.log
sudo chown -R apache:apache /opt/smokeping #这一步非常重要,否则做M/S模式,Slave不出图
d.修改配置文件
sudo mv /opt/smokeping/htdocs/smokeping.fcgi.dist /opt/smokeping/htdocs/smokeping.fcgi
sudo mv /opt/smokeping/etc/config.dist /opt/smokeping/etc/config
vim /opt/smokeping/etc/config
cgiurl = http://host-ip/smokeping.cgi
13、安装apache
yum -y install httpd
14、修改apache配置文件
vi /etc/httpd/conf/httpd.conf
Alias /smokeping "/opt/smokeping/htdocs/smokeping.fcgi"
Alias /cache "/opt/smokeping/cache/"
Alias /cropper "/opt/smokeping/htdocs/cropper/"
<Directory "/opt/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>