四、smokeping配置

mkdir /usr/local/smokeping/htdocs/cache
mkdir /usr/local/smokeping/var
 

4.1config文件配置

cp /usr/local/smokeping/etc/config.dist  config
 
*** General ***
owner    = benson.zhang
contact  = [email protected]
mailhost = my.mail.host
sendmail = /usr/lib/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 p_w_picpaths.
imgcache = /usr/local/smokeping/htdocs/cache   \\ 需要手工创建
imgurl   = cache \\ 网上介绍说是 ..cache ,实验没通过
datadir  = /usr/local/smokeping/var
piddir  = /usr/local/smokeping/var
cgiurl   = http://192.168.1.236/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
# 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 ***
\\ 定义丢包率
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times  in a row
\\监测12 次,出现 2 次丢包的情况,不论丢多少个包,都进行 alter
*** Database ***
\\300ping20
step     = 300
pings    = 20
 
# 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   72
MIN  0.5 144   720
 
*** Presentation ***
\\ 页面模板
template = /usr/local/smokeping/etc/basepage.html.dist
 
+ 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 3 Hours"    3h
"Last 30 Hours"   30h
"Last 10 Days"    10d
"Last 400 Days"   400d
 
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
 
*** Probes ***
 
+ FPing
 
binary = /usr/sbin/fping \\ping 工具,安装 fping 的时候做软连接的原因
 
*** Slaves ***
secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
 
#+slave2
#display_name=another
#color=00ff00
 
 
 
*** Targets ***
 
probe = FPing
 
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of xxx Company. \
         Here you will learn all about the latency of our network.
+ Telecom    \\ 第一级目录,
menu= Telecom   \\ 此目录名称会在 web 上显示
#parents = owner:/Test/James location:/
 
++ mianyang-IDC   \\ 监控的机器标识
menu = mianyang    \\ 此目录会在 web 上显示
title = mianyang_61.139.33.1 \\ 显示的图片名称
host = 61.139.33.1   \\ 监控的地址
 
++ shenyang-IDC
menu = shenyang
title = shenyang_219.148.197.6
host = 219.148.197.6
 

4.2smokeping.cgi修改

cp /usr/local/smokeping/htdocs/smokeping.cgi.dist smokeping.cgi
 #!/usr/bin/speedy -w
 use lib qw(/usr/local/rrdtool/lib/perl); \\rrdtool lib
use lib qw(/usr/local/smokeping/lib);      \\smokeping lib
Smokeping::cgi("/usr/local/smokeping/etc/config");
 

4.3smokeping文件修改

cp /usr/local/smokeping/bin/smokeping.dist smokeping
#!/usr/bin/perl -w
use lib qw(/usr/local/rrdtool/lib/perl);
use lib qw(/usr/local/smokeping/lib);
Smokeping::main("/usr/local/smokeping/etc/config");
 
 
 

4.4、目录权限设置

smokeping目录设置为apache可读可写
说明:apache web服务的用户和组
chown -R apache:apache  /usr/local/smokeping/
 

4.5、配置文件检查并启动

/usr/local/smokeping/bin/smokeping --check 配置文件检查
/usr/local/smokeping/bin/smokeping --debug 启动调试
/usr/local/smokeping/bin/smokeping --start 启动
 

五、附录

5.1虚拟主机配置

Alias  /smokeping/  "/usr/local/smokeping/htdocs/"
    ServerAdmin [email protected]
    DocumentRoot "/usr/local/smokeping/htdocs"
    ServerName localhost
  
    Options FollowSymLinks ExecCGI
    AllowOverride None
    AddHandler cgi-script cgi
    Order allow,deny
    Allow from all
  
    ErrorLog logs/smokeping-error_log
    CustomLog logs/smokeping-access_log combined
 
参考资料:
  http://liuyu.blog.51cto.com/183345/262248/
  http://mayulin.blog.51cto.com
  http://oss.oetiker.ch/smokeping/doc/smokeping_install.en.html
 
 
smokeping-配置篇(自己配置)_第1张图片
 
smokeping-配置篇(自己配置)_第2张图片