Centos下smokeping的安装配置
Centos下smokeping的安装配置
titlecontent-title">环境:
CentOS+rrdtool+smokeping实现网络监控
前提软件需求:
freetype-devel-2.1.9-1.i386.rpm
zlib-devel-1.2.1.2-1.i386.rpm
libpng-devel-1.2.7-1.i386.rpm
libart_lgpl-devel-2.3.16-3.i386.rpm
fping
CGI-SpeedyCGI-2.22.tar.gz
系统需求:
1安装fping
64位wgethttp://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.x86_64.rpm
32位wgethttp://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.i386.rpm
2安装CGI-SpeedyCGI
wgethttp://daemoninc.com/SpeedyCGI/CGI-SpeedyCGI-2.22.tar.gz
tarzxvfCGI-SpeedyCGI-2.22.tar.gz
cdCGI-SpeedyCGI-2.22
perlMakefile.PL
make
maketest
makeinstall
3安装rrdtool
wgethttp://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.26.tar.gz
tarzxvfrrdtool-1.2.26.tar.gz
cdrrdtool-1.2.26
./configure--prefix=/usr/local/rrdtool
make
makeinstall
4安装smokeping
wgethttp://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz
tarzxvfsmokeping-2.4.2.tar.gz
ln-ssmokeping-2.4.2smokeping
5配置smokeping
首先建立两个目录:
mkdir/usr/local/smokeping/cache
mkdir/usr/local/smokeping/var
chownapache.apache/usr/local/smokeping/cache/usr/local/smokeping/var
然后修改如下几个配置文件:
(1)/usr/local/smokeping/etc/config.dist
imgcache=/usr/local/smokeping/cache
imgurl=../cache
datadir=/usr/local/smokeping/var
piddir=/usr/local/smokeping/var
cgiurl=http://smokeping.sso.cn/htdocs/smokeping.cgi
smokemail=/usr/local/smokeping/etc/smokemail.dist
tmail=/usr/local/smokeping/etc/tmail.dist
template=/usr/local/smokeping/etc/basepage.html.dist
注释掉如下:(2.42新版本下不用注释也行)
#***Slaves***
#secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#+slave2
(2)/usr/local/smokeping/htdocs/smokeping.cgi
首先,cpsmokeping.cgi.distsmokeping.cgi//生成smokeping.cgi
#!/usr/bin/speedy-w
uselibqw(/usr/local/rrdtool/lib/perl);
uselibqw(/usr/local/smokeping/lib);
Smokeping::cgi("/usr/local/smokeping/etc/config.dist");
(3)/usr/local/smokeping/bin/smokeping.dist
#!/usr/bin/perl-w
uselibqw(/usr/local/rrdtool/lib/perl);
uselibqw(/usr/local/smokeping/lib);
Smokeping::main("/usr/local/smokeping/etc/config.dist");
(4)启动smokeping
/usr/local/smokeping/bin/smokeping.diststart
(5)建立启动脚本文件
参照:http://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script
(6)配置apache/conf/httpd.conf
<VirtualHost*:80>
DocumentRoot/usr/local/smokeping
ServerNamesmokeping.sso.cn
AddHandlercgi-script.cgi
<Directory"/usr/local/smokeping/htdocs/">
AllowOverrideNone
OptionsExecCGIIndexes
Orderallow,deny
Allowfromall
</Directory>
ErrorLoglogs/ping-error_log
CustomLoglogs/ping-access_logcommon
</VirtualHost>
(7)安装完成,可以通过如下链接看到效果:
http://smokeping.sso.cn/htdocs/smokeping.cgi
参考:
http://oss.oetiker.ch/smokeping/
/usr/local/smokeping/htdocs/doc/smokeping_config.html
/usr/local/smokeping/doc/examples/
附:config.dist
***General***
owner=PeterRandom
contact=
mailhost=my.mail.host
#sendmail=/usr/lib/sendmail
imgcache=/usr/local/smokeping/cache
imgurl=../cache
datadir=/usr/local/smokeping/var
piddir=/usr/local/smokeping/var
cgiurl=http://smokeing.titan24.com/htdocs/smokeping.cgi
smokemail=/usr/local/smokeping/etc/smokemail.dist
tmail=/usr/local/smokeping/etc/tmail.dist
#specifythistogetsysloglogging
syslogfacility=local0
#eachprobeisnowruninitsownprocess
#disablethistoreverttotheoldbehaviour
#concurrentprobes=no
***Alerts***
to=
from=
+someloss
type=loss
#inpercent
pattern=>0%,*12*,>0%,*12*,>0%
comment=loss3timesinarow
***Database***
step=300
pings=20
#consfnmrhbstepstotal
AVERAGE0.511008
AVERAGE0.5124320
MIN0.5124320
MAX0.5124320
AVERAGE0.5144720
MAX0.5144720
MIN0.5144720
***Presentation***
template=/usr/local/smokeping/etc/basepage.html.dist
+charts
menu=Charts
title=Themostinterestingdestinations
++stddev
sorter=StdDev(entries=>4)
title=TopStandardDeviation
menu=StdDeviation
format=StdandardDeviation%f
++max
sorter=Max(entries=>5)
title=TopMaxRoundtripTime
menu=byMax
format=MaxRoundtripTime%fseconds
++loss
sorter=Loss(entries=>5)
title=TopPacketLoss
menu=Loss
format=PacketsLost%f
++median
sorter=Median(entries=>5)
title=TopMedianRoundtripTime
menu=byMedian
format=MedianRTT%fseconds
+overview
width=600
height=50
range=10h
+detail
width=600
height=200
unison_tolerance=2
"Last3Hours"3h
"Last30Hours"30h
"Last10Days"10d
"Last400Days"400d
***Probes***
+FPing
binary=/usr/sbin/fping
#***Slaves***
#secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#+slave2
***Targets***
probe=FPing
menu=Top
title=NetworkLatencyGrapher
remark=WelcometotheSmokePingwebsiteofxxxCompany.\
Hereyouwilllearnallaboutthelatencyofournetwork.
+CNC
menu=CNC
title=CNC
++xizang
menu=xizang
title=xizang
host=221.13.80.14
++shanxi_wt
menu=shanxi
title=shanxi_wt
host=221.11.66.1
++beijing
menu=beijing
title=beijing
host=202.99.57.149
++tianjin
menu=tianjin
title=tianjin
host=218.69.32.6
++shijiazhuang
menu=shijiazhuang
title=shijiazhuang
host=202.99.160.234
++shanxi
menu=shanxi
title=shanxi
host=218.26.125.150
++neimenggu
menu=neimenggu
title=neimenggu
host=202.99.226.58
++heilongjiang
menu=heilongjiang
title=heilongjiang
host=61.138.38.114
++jilin
menu=jilin
title=jilin
host=125.32.127.14
++liaoning
menu=liaoning
title=liaoning
host=218.61.254.174
++shandong
menu=shandong
title=shandong
host=60.215.136.234
++henan
menu=henan
title=henan
host=61.168.254.26
+TELCOM
menu=telcom
title=telcom
++beijing_dx
menu=beijing_dx
title=beijing_dx
host=218.30.66.57
++shanghai_dx
menu=shanghai_dx
title=shanghai_dx
host=202.101.63.193
++jiangsu_dx
menu=jiangsu_dx
title=jiangsu_dx
host=61.147.37.1
++zhejiang_dx
menu=zhejiang_dx
title=zhejiang_dx
host=220.191.129.118
++anhui_dx
menu=anhui_dx
title=anhui_dx
host=61.190.251.38
++wenzhou_dx
menu=wenzhou_dx
title=wenzhou_dx
host=202.97.40.86
++jiangxi_dx
menu=jiangxi_dx
title=jiangxi_dx
host=220.177.252.94
++hubei_dx
menu=hubei_dx
title=hubei_dx
host=221.232.254.62
++hunan_dx
menu=hunan_dx
title=hunan_dx
host=61.137.2.14
++guangdong_dx
menu=guangdong_dx
title=guangdong_dx
host=61.144.3.13
++hainan_dx
menu=hainan_dx
title=hainan_dx
host=59.50.32.70
++guangxi_dx
menu=guangxi_dx
title=guangxi_dx
host=218.65.136.2
++chongqing_dx
menu=chongqing_dx
title=chongqing_dx
host=219.153.16.97
++sichuan_dx
menu=sichuan_dx
title=sichuan_dx
host=218.6.196.70
++guizhou_dx
menu=guizhou_dx
title=guizhou_dx
host=219.151.0.142
++yunnan_dx
menu=yunnan_dx
title=yunnan_dx
host=222.221.1.30
.