SmokePing之配置文件config详解

这个配置文件无论在Linux下面仍是在BSD下面是一致的。
以下解说:
整个config文件里面只有 #注释
第一部分 General 属于基本配置。值得注意的地方有imgcache和imgurl这两个参数,要注意一下,和apache配置相关联,若是配置很差的话,打开web的时候图片会显示不出来。
*** General ***
owner    = Kevin Deng
contact  = kevinadmin@sohu.com
mailhost = smtp.sohu.com
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 p_w_picpaths.
imgcache = /usr/local/smokeping/htdocs/img
imgurl   = img
datadir  = /usr/local/var/smokeping
piddir  = /usr/local/var/smokeping
cgiurl   = http://192.168.0.206/smokeping/smokeping.cgi
smokemail = /usr/local/etc/smokeping/smokemail
tmail = /usr/local/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 是属于报警配置, 这个我尚未测试过。之后再说
+someloss
type = loss
# in percent
#pattern = >0%,*12*,>0%,*12*,>0%
#comment = loss 3 times  in a row
pattern = ==S,>0%,>0%,>0%
comment = loss at startup
+rttdetect
type = rtt
# in milli seconds
pattern = <10,<10,<10,<10,<10,<100,>100,>100,>100
comment = routing mesed up again ?
第三部分 Database RRD数据库配置。step和pings这两个参数要在启动smokeping以前配置好,若是在smokeping启动后再配置这两个参数,须要把原来的rrd文件都删除,而后再启动smokeping才能够。因此这个必定要先配置好。默认是step=300 pings=20 应该是每300s内执行20次ping的动做

*** Database ***
step     = 300
pings    = 60
# 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 是关于网络状态的一些配置和解释,基本不须要更改
*** Presentation ***
template = /usr/local/etc/smokeping/basepage.html
charset = gb2312
+ 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和detail里面是图片大小设置,能够按需来设置
+ overview
width = 800
height = 50
range = 10h
+ detail
width = 800
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
第五部分Porbes 指针配置,咱们通常只用到fping因此就只要如下配置就能够了,肯定路径是否正确,这里还能够设置fping包的大小,参数是packetsize
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
packetsize = 2000
第六分部Slaves 主从关系里面的从服务器相关配置,smokeping里面从服务器只须要安装好就能够了,不须要配置,smokeping的全部配置都是在master上面设置。这里主要设置好secrets密码文件和从服务器配置就能够了。下面我配置了两个从服务器。一个是st,一个是fy
*** Slaves ***
#secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
secrets = /usr/local/etc/smokeping/slavesecrets.conf
#+boomer
#display_name=boomer
#color=0000ff
#location = HuaDong
+ st
display_name = ShanTou Monitor
color = 0000ff
#location = HuanDong
+ fy
display_name = FuYong
color = 00ff00
#++ override
#Probes.FPing.binary = /usr/bin/fping
第七部分 Targets 目标配置。在这里能够单独配置一台服务器的监控状况,须要从slave服务器上取值的配置也是在这里配置。我已经用注释说明的很清楚了。
这里要注意一下。+表明一级菜单 +下面的++是继承上面的+成为二级菜单。 并且能够有多个一级菜单和二级菜单。

*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of ShenZhen Wang Yu Company. \
        Here you will learn all about the latency of our network.
####### Slaves Configure ###########
+ Slaves
menu = Slaves
title = All of the Monitor From the Slaves
++ ShanTou
menu = ShanTou
title = Host 192.168.0.208 Monitor From Slaves
slaves = st fy
host = 192.168.0.208
++ FuYong
menu = FuYong
title = Host 192.168.0.210 Monitor From Slaves
slaves = fy st
host = 192.168.0.210

######## Single Hosts Monitor Configure ########
+ Hosts
menu = Single
#parents = owner:/Test/James location:/
#title = Host in Test
title = Single Host Monitor
#++ James
#menu = James
#title =James
#alerts = someloss
#slaves = boomer slave2
#host = 192.168.0.205
++ QQ
menu = QQ
title = www.qq.com
host = www.qq.com
++ MFS-Monitor
menu = MFS-Monitor
title = Monitor
host = 192.168.0.210
++ TaiWan
menu = TaiWan-Server
title = 229.84.216.201
host = 229.84.216.201
+ Monitor
menu = Monitor Servers
title = Monitor Server Hosts
++ ShenZhen
menu = ShenZhen
title = SZ-Cacti
host = 192.168.0.208

############# MultiHost Monitor In One Graph Configure #####
+ MultiHost
menu = Multihost
#title = James and James as seen from Boomer
title = All Host In One Graph
host = /Hosts/QQ /Hosts/MFS-Monitor /Hosts/TaiWan
主/从 作分布式监控的时候有几点须要注意
1.主从服务器上面的密码文件权限必须为600  并且主服务器上面的密码文件的属主必须为apache的启动用户
2.从服务器上面的密码文件只须要一个密码就行,也就是主上面为它配置的那个密码。一样从服务器上面的密码文件的属主必须为smokeping的启动用户
下面是主/从作分布式监控时我碰到的问题,及解决办法。写了一个简单的FQA
Q:Slave启动的时候报错。
[root@Nagios etc]# /usr/local/smokeping/bin/smokeping --master-url=http://192.168.0.206/smokeping/smokeping.cgi --cache-dir=/usr/local/smokeping/var/ --shared-secret=/usr/local/smokeping/etc/smokeping_secrets --slave-name=ShenZhen
WARNING: Opening secrets file /usr/local/etc/smokeping/slavesecrets.conf: Permission denied
ERROR: we did not get config from the master. Maybe we are not configured as a slave for any of the targets on the master ?
A:
在master上面 对slavesecrets.conf文件 执行以下命令:
chow smokeping slavesecrets.conf
Q:
[root@Nagios etc]# /usr/local/smokeping/bin/smokeping --master-url=http://192.168.0.206/smokeping/smokeping.cgi --cache-dir=/usr/local/smokeping/var/ --shared-secret=/usr/local/smokeping/etc/smokeping_secrets --slave-name=ShenZhen
WARNING: Data from ShenZhen was signed with 58e8b1b17440aa40fac67161b8c7a328 which does not match our expectation
ERROR: we did not get config from the master. Maybe we are not configured as a slave for any of the targets on the master ?
A:
这个错误就是本地的密码文件配置错误,本地密码文件只保存master上面配置你这台slave的密码,只须要一个密码就能够了
Q:
[root@Nagios etc]# /usr/local/smokeping/bin/smokeping --master-url=http://192.168.0.206/smokeping/smokeping.cgi --cache-dir=/usr/local/smokeping/var/ --shared-secret=/usr/local/smokeping/etc/smokeping_secrets
WARNING: No secret found for slave Nagios.kevinadmin.org
ERROR: we did not get config from the master. Maybe we are not configured as a slave for any of the targets on the master ?
A:
在master上面的密码文件里加上Nagios.kevinadmin.org及对应的密码就能够了。

Q:
[root@Nagios etc]# /usr/local/smokeping/bin/smokeping --master-url=http://192.168.0.206/smokeping/smokeping.cgi --cache-dir=/usr/local/smokeping/var/ --shared-secret=/usr/local/smokeping/etc/smokeping_secrets
WARNING: I don't know the slave Nagios.kevinadmin.org ignoring it
ERROR: we did not get config from the master. Maybe we are not configured as a slave for any of the targets on the master ?
A:
这个是指在config文件里面没有定义Nagios.kevinadmin.org这个从服务器
相关文章
相关标签/搜索