centos搭建SmokePing监控IDC丢包延迟

http://www.myhack58.com/Article/sort099/sort0102/2013/40287.htm


一、概述

最 近产品老是报托管到机房的服务器高峰期合作商的一个IP丢包,自己测试了到目标IP确实丢包(同网段一个丢一个不丢),但是ping别的门户网站正常,合 作伙伴是国内网络设备部大亨难道他们的网络有问题,经过一起调试他们死活认为我的网络有问题,我联系IDC机房(国内最牛X的)机房网络检测了几天说机房 网络正常对方问题。
奇葩了!!!受老板鸭梨必须查出丢包原因和丢包点,没办法只有请SmokePing出来给我监控找答案了。。。。下面进入正题搭建SmokePing实战!
1、环境
系统 centos5.8 64bit
安装环境
http rrdtool fping smokeping CGI-SpeedyCGI

二、安装环境
1、更新yum源

rpm -Uvh http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

2、yum安装环境

yum -y install gcc gcc-* make man file vim-enhanced openssh-clients lftp ftp wget curl elinks httpd httpd-devel expect ntp pango system-config-network-tui libxml2-devel libpng-devel pango pango-devel libart_lgpl libart_lgpl-devel freetype freetype-devel fontconfig cairo cairo-devel sendmail
yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI
yum install fping echoping

3、安装rrdtool

wget http://bcs.duapp.com/xiueli/rrdtool.tar.gz
tar zxvf rrdtool.tar.gz
mv rrdtool /usr/local/
ln /usr/local/rrdtool/bin/rrdtool /usr/bin
#这个包的rrdool是1.4.5的已经编译好的
/usr/local/rrdtool/bin/rrdtool   #可以查看版本

4、安装smokeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz
tar zxvf smokeping-2.4.2.tar.gz
mv smokeping-2.4.2 /usr/local/smokeping

5、配置smokeping (这步是搭建smokeping最难的了)

cp /usr/local/smokeping/bin/smokeping.dist /usr/local/smokeping/bin/smokeping
cp /usr/local/smokeping/htdocs/smokeping.cgi.dist /usr/local/smokeping/htdocs/smokeping.cgi
mkdir -p /usr/local/smokeping/htdocs/img
mkdir -p /usr/local/smokeping/var
vim /usr/local/smokeping/bin/smokeping
内容如下
#!/usr/bin/perl -w
# -*-perl-*-

use lib qw(/usr/local/rrdtool/lib/perl/);   #需要更改
use lib qw(/usr/local/smokeping/lib/);      *需要更改
use strict;
use warnings;
use Smokeping 2.004002;

Smokeping::main("/usr/local/smokeping/etc/config.dist");   #需要更改

vim /usr/local/smokeping/htdocs/smokeping.cgi
#更改,还是上面那三处
#!/usr/bin/speedy
# -*-perl-*-

use strict;
use warnings;

use lib qw(/usr/local/rrdtool/lib/perl/);  
use lib qw(/usr/local/smokeping/lib/);  

use CGI::Carp qw(fatalsToBrowser);

use Smokeping 2.004002;

Smokeping::cgi("/usr/local/smokeping/etc/config.dist");

最重要的config.dist配置
见http://www.yinxiulei.cn/smokeping配置文件.html

6、设置登录密码

 htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin

7、apache配置

vi /etc/httpd/conf.d/smkeping.conf
#加入下面内容

    ServerAdmin 627526297@qq.com
    DocumentRoot "/usr/local/smokeping/htdocs"
    ServerName localhost
   
    Options FollowSymLinks ExecCGI
    AllowOverride None
    AddHandler cgi-script cgi
    Order allow,deny
    Allow from all
    AuthName "Smokeping"
    AuthType Basic
    AuthUserFile /usr/local/smokeping/htdocs/htpasswd
    Require valid-user
    ErrorLog logs/smokeping-error_log
    CustomLog logs/smokeping-access_log combined

三、启动服务器

/etc/init.d/httpd start
/usr/local/smokeping/bin/smokeping start

如正常启动打开网站

http://ip/smokeping/smokeping.cgi

ps问题解决
smokeping无图图片叉叉,检查配置文件中的imgcache
看imgcache目录内是否有数据,目录是否在htdocs内

<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(774) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
posted @ 2016-02-01 00:00  张同光  阅读(150)  评论(0编辑  收藏  举报