首页 > 代码库 > smokeping 监控

smokeping 监控

# 公司新拉了一个线路,需要测试网络质量以及丢包率,找了许久才找着有smokeping这款软件

     以下主要功能 _用于监控公司网络质量,地址都使用的是各地的教育网地址,还有各地机房连接


el7也有一键安装,源码包比较费劲:一部分依赖包,拉至最下面有安装

技术分享

下载:http://pan.baidu.com/s/1hrJiLBA


安装可以使用yum包一键安装  系统el6

下载地址: http://mirror.ghettoforge.org/distributions/gf/el/6/gf/x86_64//smokeping-2.6.11-1.gf.el6.x86_64.rpm

各种依赖包:rrdtool-perl perl-Config-Gramar rrdtool 



#   这里配置一直到效果图都是使用的el6的系统

安装完之后需要配置apache   否则登陆会有权限问题:

修改:/etc/httpd/conf.d/smokeping.conf

<Directory "/usr/share/smokeping" >

#  Order allow,deny

  Allow from 192.168.x.0/24         允许访问的地址

  Deny from all

</Directory>


<Directory "/var/lib/smokeping" >

  Allow from 192.168.x.0/24

  Deny from all

</Directory>





smokeping 配置:/etc/smokeping/config

配置如下

*** General ***


owner    = Super User

contact  = root@localhost

mailhost = my.mail.host

sendmail = /usr/sbin/sendmail

# NOTE: do not put the Image Cache below cgi-bin

# since all files under cgi-bin will be executed ... this is not

# good for images.

imgcache = /var/lib/smokeping/images

imgurl   = /smokeping/images

datadir  = /var/lib/smokeping/rrd

piddir   = /var/run/smokeping

cgiurl   = http://localhost/smokeping/sm.cgi

smokemail = /etc/smokeping/smokemail

tmail     = /etc/smokeping/tmail

# specify this to get syslog logging

syslogfacility = local0

# each probe is now run in its own process

# disable this to revert to the old behaviour

# concurrentprobes = no


*** Alerts ***

to = root@localhost

from = root@localhost


+someloss

type = loss

# in percent

pattern = >0%,*12*,>0%,*12*,>0%

comment = loss 3 times  in a row


*** Database ***


step     = 200

pings    = 15


# consfn mrhb steps total


AVERAGE  0.5   1  1008

AVERAGE  0.5  12  4320

    MIN  0.5  12  4320

    MAX  0.5  12  4320

AVERAGE  0.5 144   720

    MAX  0.5 144   720

    MIN  0.5 144   720


*** Presentation ***


template = /etc/smokeping/basepage.html

charset = utf-8


+ charts


menu = Charts

title = The most interesting destinations


++ stddev

sorter = StdDev(entries=>4)

title = Top Standard Deviation

menu = Std Deviation

format = Standard Deviation %f


++ max

sorter = Max(entries=>5)

title = Top Max Roundtrip Time

menu = by Max

format = Max Roundtrip Time %f seconds


++ loss

sorter = Loss(entries=>5)

title = Top Packet Loss

menu = Loss

format = Packets Lost %f


++ median

sorter = Median(entries=>5)

title = Top Median Roundtrip Time

menu = by Median

format = Median RTT %f seconds


+ overview 


width = 600

height = 50

range = 10h


+ detail


width = 600

height = 200

unison_tolerance = 2


"Last 1 Hours"    1h

"Last 3 Hours"    3h

"Last 5 Hours"    5h

"Last 30 Hours"   30h

"Last 10 Days"    10d

"Last 30 Days"    30d


#+ hierarchies

#++ owner

#title = Host Owner

#++ location

#title = Location


*** Probes ***


+ FPing


binary = /usr/sbin/fping


*** Slaves ***

secrets=/etc/smokeping/smokeping_secrets

+boomer

display_name=boomer

color=0000ff


+slave2

display_name=another

color=00ff00


*** Targets ***


#menuextra = <a target=‘_blank‘ href=http://www.mamicode.com/‘/smokeping/tr.html{HOST}‘ class=‘{CLASS}‘ /

#               onclick="window.open(this.href,this.target, \

#               ‘width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no‘); \

#                return false;">*</a>

#

probe = FPing


menu = Top

title = Network Latency Grapher

remark = Welcome to the SmokePing website of <b>Insert Company Name Here</b>. \

         Here you will learn all about the latency of our network.


+ Ping


menu = TEST

title = test


++ baidu

menu = baidu

title = baidu

host = 115.239.210.27


++ sohu

menu = sohu

title = sohu

host = 42.81.12.126


+ ALL_JYW 


menu = 全国各地教育网地址

title = ALL_JYW_IP


++ TJYYDX

menu = 同济医药大学

title = 同济医药大学

host = 202.114.128.1


++ ZNCJDX

menu = 中南财经大学

title = 中南财经大学

host = 202.114.224.1


++ WHKJDX

menu = 武汉科技大学

title = 武汉科技大学

host = 202.114.240.1


++ DZKJDX

menu = 电子科技大学

title = 电子科技大学

host = 202.115.000.1


++ SCGYXY

menu = 四川工业学院

title = 四川工业学院

host = 202.115.144.1


++ XLGXY

menu = 西南工学院

title = 西南工学院

host = 202.115.160.1


++ SKLYDX

menu = 四川农业大学

title = 四川农业大学

host = 202.115.176.1


++ GD

menu = 广东

title = 广东

host = 202.116.224.1


++ GGYKDX

menu = 中国医药大学

title = 中国医药大学

host = 202.118.040.1


++ HRBSFDX

menu = 哈尔滨师范大学

title = 哈尔滨师范大学

host = 202.118.128.1


++ HRBGCDX

menu = 哈尔滨工程大学

title = 哈尔滨工程大学

host = 202.118.176.1


++ LJXZSFXX

menu = 南京晓庄师范学校

title = 南京晓庄师范学校

host = 202.119.133.1


++ LJDLGDZKXJ

menu = 南京电力高等专科学校

title = 南京电力高等专科学校

host = 202.119.160.1


++ JSSJYWYH

menu = 江苏省教育委员会

title = 江苏省教育委员会

host = 202.119.172.1


++ LJLKDX

menu = 南京林业大学

title = 南京林业大学

host = 202.119.208.1


++ SHJTDX

menu = 上海交通大学

title = 上海交通大学

host = 202.120.000.1


++ SHYKDX

menu = 上海医药大学

title = 上海医药大学

host = 202.120.064.1



#安装完之后直接重启httpd跟smokeping就能访问了 访问地址:

http://安装机器ip/smokeping/sm.cgi


效果图:

技术分享

技术分享

# 安装配置

            1:http://blog.sina.com.cn/s/blog_6151984a0100euux.html

            2:http://sr2009.blog.51cto.com/742434/1151064    


# 全国各地教育网地址:http://www.doc88.com/p-8999207274546.html








el7的安装 

yum -y installrrdtool fping echoping curl dig openssh bind perl fcgi popt-devel popt libidn libidn-develfcgi fcgi-devel perl-devel

 

# 安装系统组件包

yum install gccfreetype-devel zlib-devel libpng-devel libart_lgpl-devel httpd-develapr-util-devel apr-devel cairo cairo-devel pango pango-devel libxml2libxml2-devel perl-XML-Simple.noarch perl-Crypt-SSLeay perl-Digest-HMAC

 

# 安装perl插件包

yum-y install lperl-IO-Socket-SSL perl-Net-DNS perl-Socket6 perl-CGI perl-FCGI perl-Config-Grammar  perl-libwww-perl perl-Net-Telnet perl-Net-OpenSSHperl-Authen-Radius  perl-Net-IP  perl-Data-HexDump perl-ExtUtils-Embedperl-Net-SNMP perl-CPANperl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-ExtUtils-Manifest perl-CGI perl-FCGIperl-Sys-Syslog

 

安装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

 

安装echoping

#下载地址:http://down.51cto.com/data/612292
tar zxvf echoping-6.0.0.tar.gz 
cd echoping-6.0.0
./configure
make
make test
make install

 

安装smokeping

tarxf SmokePing-2.6.11.tar.gz

bash release-smokeping.sh

 

tarxf IO-Tty-1.07.tar.gz

cd IO-Tty-1.07

perlMakefile.PL

make-j 2 && make -j install

 

tarxf perl-ldap-0.56.tar.gz

cdperl-ldap-0.56

make-j 2 && make -j install

 

#安装smokeping

[root@db3 SmokePing-2.6.11]#./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

[root@db3SmokePing-2.6.11]# ./configure --prefix=/usr/local/smokeping

[root@db3SmokePing-2.6.11]# gmake install

 

 


常见问题解决

 

# 解决

configure:error: Get the GNU libidn library (http://www.josefsson.org/libidn/) in orderto use Unicode - multi-script - domain names or use --without-libidn to disableit

# 解决方法:安装libidn-devel 

# 下载地址http://mirror.centos.org/centos/7/os/x86_64/Packages/libidn-devel-1.28-4.el7.x86_64.rpm

 

# 安装smokeping  问题一:

Can‘tlocate ExtUtils/Manifest.pm in @INC (@INC contains:FatPacked::19757960=HASH(0x12d7b88)/tmp/smokeping-24859-build/thirdparty/lib/perl5 /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/tmp/smokeping-24859-build/thirdparty/bin/cpanm line 132

解决方法:.安装yum -y install perl-ExtUtils-Embed

 

 

Can‘tlocate Sys/Syslog.pm in @INC (@INC contains:

解决方法:.安装yum -y install perl-Sys-Syslog

 

 

checkingchecking for perl module ‘Net::LDAP‘... Can‘t locate Net/LDAP.pm in @INC

安装:net-ldap软件包

下载地址:http://www.cpan.org/authors/id/M/MA/MARSCHAP/perl-ldap-0.56.tar.gz

 

 

 

Can‘tlocate CPAN.pm in @INC (@INC contains: inc /usr/local/lib64/perl5/usr/local/share/perl5 /usr/lib64/perl5/vendor_perl/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) atinc/Module/AutoInstall.pm line 277.

# 安装yum -y install perl-CPAN.

 

Can‘tlocate 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 .) atMakefile.PL line 3.

 

# 安装yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y

 

Can‘tlocate ExtUtils/Manifest.pm in @INC (@INC contains: ./lib/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/usr/share/perl5/vendor_perl/ExtUtils/MakeMaker.pm line 825.

yum-y install perl-ExtUtils-Manifest

 

 

Warning:prerequisite Test::More 0 not found

解决方法:

下载地址:https://metacpan.org/release/Test-Most

 

 


Can‘tlocate ExtUtils/Manifest.pm in @INC

解决方法:yum install perl-core

 







本文出自 “xiong” 博客,请务必保留此出处http://xiong51.blog.51cto.com/5239058/1945233

smokeping 监控