1. 程式人生 > >CentOS 6.5搭建Smokeping平臺(上)

CentOS 6.5搭建Smokeping平臺(上)

smokeping

1、添加EPEL和RPMForge第三方源

如果是i686平臺:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.i686.rpm

如果是x86_64平臺:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm


2、安裝rrdtool與依賴庫

yum -y installperl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerlperl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-CGI-SpeedCGIperl-Time-HiRes perl-ExtUtils-MakeMaker perl-RRD-Simple rrdtool rrdtool-perlcurl fping echoping  httpd httpd-develgcc make  wget libxml2-devel libpng-develglib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devellibart_lgpl libart_lgpl-devel mod_fastcgi screen


3、下載與安裝smokeping

wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
tar -zxvfsmokeping-2.6.11.tar.gz
cdsmokeping-2.6.11
./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.pm

cp xxx/xxx/RRDs.pm /usr/lib/perl5/

cp xxx/xxx/RRDs.so /usr/lib/perl5/

若是64位的服務器,則cp to /usr/lib64/perl5/


4、配置smokeping

1)創建cache、data、var目錄

mkdir -p/usr/local/smokeping/cache /usr/local/smokeping/data /usr/local/smokeping/var

2)創建日誌文件

touch/var/log/smokeping.log

3)授權

chownapache:apache cache data var
chownapache:apache /var/log/smokeping.log

4)修改配置文件

cd/usr/local/smokeping/htdocs/
mvsmokeping.fcgi.dist smokeping.fcgi
cd/usr/local/smokeping/etc
mv config.distconfig
vim config
    cgiurl=http://XXX.XXX.53.223/smokeping.cgi 
    charset = utf-8

5)修改密碼文件權限

chmod 600/usr/local/smokeping/etc/smokeping_secrets.dist

6)修改apache的配置

vim/etc/httpd/conf/httpd.conf
    DocumentRoot "/var/www/html"
    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">
        AllowOverrideNone
        Options All
        AddHandlercgi-script .fcgi .cgi
        Order allow,deny
        Allow from all
        DirectoryIndexsmokeping.fcgi
    </Directory>

7)開機啟動與安全策略

echo "/usr/local/smokeping/bin/smokeping--logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
chkconfig httpd on
iptables -t filter -I INPUT -p tcp --dport 80 -j ACCEPT
setenforce 0


5、測試驗證

技術分享







本文出自 “Gorilla City” 博客,請務必保留此出處http://juispan.blog.51cto.com/943137/1954561

CentOS 6.5搭建Smokeping平臺(上)