美文网首页
Somkeping搭建

Somkeping搭建

作者: 钟大發 | 来源:发表于2017-02-22 18:32 被阅读0次

    smokeping 是由perl 写的一个用于实时监控外网网络的软件,通过rrd 生成图表监控,用于IDC网络的监控是非常有效果的

    依赖包安装

    yum install libxml2-devel libpng-devel pango pango-devel libart_lgpl libart_lgpl-devel freetype freetype-devel fontconfig cairo cairo-devel httpd httpd-devel perl-ExtUtils-MakeMaker perl-CGI perl-FCGI fping
    

    rrd tool 以及绘图工具安装

    tar -zxvf Config-Grammar-1.10.tar.gz
    cd Config-Grammar-1.10
    perl Makefile.PL
    make && make install
    tar zxvf rrdtool-1.4.3.tar.gz
    cd rrdtool-1.4.3
    ./configure --prefix=/usr/local/rrdtool
    make
    make install
    tar zxvf smokeping-2.6.8.tar.gz
    

    安装smokeping

    cd smokeping-2.6.8
    ./configure --prefix=/usr/local/smokeping
    

    会有如下提示:

    #checking checking for perl module 'RRDs'... Failed
    #checking checking for perl module 'FCGI'... Ok
    #checking checking for perl module 'CGI'... Ok
    #checking checking for perl module 'CGI::Fast'... Ok
    #checking checking for perl module 'Config::Grammar'... Failed
    #checking checking for perl module 'Digest::HMAC_MD5'... Failed
    #checking checking for perl module 'LWP'... Ok
    

    说明对应的依赖包有问题,将之前装的rrdtool的pm 文件拷贝到smokeping下

    cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/RRDs.pm /usr/lib64/perl5/
    cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib64/perl5/
    

    其他perl的关联包用下面这个去装

    ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty 
    

    之后gmake

    gmake install
    

    大多数会一切顺利,但如果本机的环境变量有设置过的话,有时候会爆一个以下的错误:

     #Resetting LC_NUMERIC failed probably because your international setup of the LC_ALL to "en_US.UTF-8" is overridding LC_NUMERIC.  Setting LC_ALL is not compatible with smokeping... at ../lib/Smokeping.pm line 44
    

    看了下代码,这个感觉是个bug,可以改下Smokeping.pm 里面的变量,要改成当前env下的变量,LC_ALL=LC_ALL=en_US.UTF-8,然后gmake 就好了。
    smokeping的页面访问方式是通过CGI 实现的,所以需要配置一下:

    cd /usr/local/smokeping/
    mkdir cache data var
    chown apache.apache cache data var
    cd /usr/local/smokeping/htdocs/
    cp smokeping.fcgi.dist smokeping.fcgi
    cd /usr/local/smokeping/etc/
    cp config.dist config
    chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist
    ln -s /usr/local/smokeping/cache /usr/local/smokeping/htdocs/cache
    

    同时修改对应的config 文件 ,/usr/local/smokeping/etc/config 并且启动:

    /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
    
    #修改apache
    
    Alias /smokeping/ "/usr/local/smokeping/htdocs/"
    <Directory "/usr/local/smokeping/">
    AllowOverride None
    Options All
    AddHandler cgi-script .fcgi .cgi
    Order allow,deny
    Allow from all
    DirectoryIndex smokeping.fcgi
    </Directory>
    
    /etc/init.d/apache restart
    #重启apache
    

    相关文章

      网友评论

          本文标题:Somkeping搭建

          本文链接:https://www.haomeiwen.com/subject/pbvmwttx.html