本文共 5939 字,大约阅读时间需要 19 分钟。
如果是64位为[root@localhost src]# uname -aLinux localhost.localdomain 2.6.18-274.3.1.el5 #1 SMP Tue Sep 6 20:13:52 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux [root@localhost Test]# perl -vThis is perl, v5.8.8 built for x86_64-linux-thread-multi准备工作请先暂时关闭iptables以及selinux刨除其他影响/etc/init.d/iptables stop/etc/init.d/ip6tables stopsetenforce 0或者 vi /etc/sysconfig/selinux将 SELINUX=enforcing改成 SELINUX=disabled重启后生效1 安装web服务器 a yum 源 设置163的源 重新生成下缓存yum makecache b 安装支持环境 yum install httpd yum install httpd-devel yum install gcc make yum install perl-devel perl-Time-HiRes yum install rrdtool-perl2 安装rrdtool a rrdtool依赖的库 yum install libxml2-devel libpng-devel yum install pango pango-devel yum install libart_lgpl libart_lgpl-devel yum install freetype freetype-devel fontconfig cairo cairo-devel yum -y install libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel b 安装 rrdtool wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz tar -zxvf rrdtool-1.4.5.tar.gz cd rrdtool-1.4.5 ./configure --prefix=/usr/local/rrdtool --disable-tcl --disable-python make && make install RRDTOOL安装后验证 /usr/local/rrdtool/bin/rrdtool -v 出现以下RRDTOOL的信息就已经成功了 RRDtool 1.4.5 Copyright 1997-2010 by Tobias Oetiker 3 安装fping a 安装cgilib wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz tar zxvf cgilib-0.5.tar.gz cd cgilib-0.5 make cp libcgi.a /usr/local/lib cp cgi.h /usr/include/ b 安装fping wget http://oss.oetiker.ch/smokeping/pub/fping-2.4b2_to4-ipv6.tar.gz tar zxvf fping.tar.gz cd fping-2.4b2_to/ ./configure make && make install 测试是否正常 fping -t 100 202.96.134.1344 安装echoping a 安装gettext wget http://42.120.20.242/gettext-0.18.1.1.tar.gz tar xzvf gettext-0.18.tar.gz cd gettext-0.18 ./configure make && make install b 安装popt wget http://42.120.20.242/popt-1.7.tar.gz tar zxvf popt-1.7.tar.gz cd popt-1.7 ./configure make && make install c 安装echoping wget http://jaist.dl.sourceforge.net/project/echoping/echoping/6.0.0/echoping-6.0.0.tar.gz tar zxvf echoping-6.0.0.tar.gz cd echoping-6.0.0 ./configure --without-libidn make && make install [root@localhost ~]# whereis echoping echoping: /usr/local/bin/echoping /usr/local/lib/echoping5 安装FCGI wget http://cpan.communilink.net/authors/id/F/FL/FLORA/FCGI-0.74.tar.gz tar zxvf FCGI-0.74.tar.gz cd FCGI-0.74 perl Makefile.PL make && make install 6 安装mod_fastcgi wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz tar zxvf mod_fastcgi-2.4.6.tar.gz cd mod_fastcgi-2.4.6 /usr/sbin/apxs -o mod_fastcgi.so -c *.c /usr/sbin/apxs -i -a -n fastcgi .libs/mod_fastcgi.so 确定 /etc/httpd/conf/httpd.conf 有 LoadModule fastcgi_module modules/mod_fastcgi.so 也有可能是 LoadModule fastcgi_module /usr/lib64/httpd/modules/mod_fastcgi.so7 安装smokeping wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.6.tar.gz tar zxvf smokeping-2.6.6.tar.gz cd smokeping-2.6.6 ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty ./configure --prefix=/usr/local/smokeping /usr/bin/gmake install解决“checking checkingfor perl module ‘RRDS’…Failed”的问题由于我们是编译安装的rrdtool,所以perl没找到默认路径下它的模块,需要手工拷贝过去。先搜素 find / -name RRDs.pmcp xxx/xxx/RRDs.pm /usr/lib/perl5/cp xxx/xxx/RRDs.so /usr/lib/perl5/若是64位的服务器,则cp to /usr/lib64/perl5/ 修改配置文件 cd /usr/local/smokeping/bin/ vim smokeping 第五行:use lib qw(); # PERL5LIB 修改为:use lib qw(/usr/local/rrdtool/lib/perl); # PERL5LIB cd ../etc/ cp config.dist config 修改配置文件 192.168.1.230 为服务器的ip (此为smokeping的http访问路径) vim config 10 imgcache = /var/www/html/smokeping/img 11 imgurl = http://192.168.1.230/smokeping/img 14 cgiurl = http://192.168.1.230/smokeping/smokeping.cgi 108 binary = /usr/local/sbin/fping之后修改后面添加监控点 8 配置HTTP运行环境 a 创建目录 mkdir -p /var/www/html/smokeping/img /var/www/html/smokeping/script/ /usr/local/smokeping/data /usr/local/smokeping/var b 建立软链接,把smokping目录下的文件软链接到HTTP目录下 ln -s /usr/local/smokeping/htdocs/cropper /var/www/html/smokeping/cropper ln -s /usr/local/smokeping/htdocs/smokeping.fcgi /var/www/html/smokeping/smokeping.fcgi c 分配权限 chown -R apache:apache /var/www/html/smokeping/ d 修改HTTP 配置文件 vim /etc/httpd/conf/httpd.conf 将ServerName www.exple.com:80 改为 ServerName localhost:80 将这行注释掉# Options Indexes FollowSymLinks 添加下面一行 Options Indexes FollowSymLinks ExecCGI 修改DirectoryIndex index.html index.html.var为 DirectoryIndex index.html index.html.var /smokeping/smokeping.fcgi 修改AddHandler cgi-script .cgi AddHandler cgi-script .fcgi e 启动httpd service httpd start9 启动smokeping chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist nohup /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 & perl /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 访问http://IP/smokeping不出图的解决思路(个人总结)、(1)、可以使用--debug方式启动smokeping看是否有问题(2)、查看smokeping日志(3)、查看http的error.log,很多情况可以告诉你出错的地方(4)、查看文件权限 a、data文件夹是否可写 /usr/local/smokeping/data b、data文件夹下是否有你所创建监控主机的目录,以本例来说就是Test,查看是否可写 /usr/local/smokeping/data c、Test文件下是否有你所创建的设备名的.rrd文件,本例中为(James.rrd) /usr/local/smokeping/data/Test d、可以看下James.rrd是否会5分钟更新一次(mtime) /usr/local/smokeping/data/Test e、查看/var/www/html/smokeping/img文件夹权限 (主、组为apache运行用户主、组,默认下权限为755) f、启动smokeping后查看cache文件夹内是否有rrdtool.png smokeping.png两个图片 /var/www/html/smokeping/img g、查看/var/www/html/smokeping/img下是否有你所创建的设备目录,本例中为Test并确定文件夹权限以及可写 h、查看/var/www/html/smokeping/imgTest下是否有。png图片并且会定时更新,如果没有一般为权限问题。more /usr/local/smokeping/etc/configimgcache = /var/www/html/smokeping/imgimgurl = http://222.73.109.109/smokeping/imgdatadir = /usr/local/smokeping/datapiddir = /usr/local/smokeping/var
转载于:https://blog.51cto.com/linuxpython/1625627