Smokeping 配置文件config详解

这个配置文件不管在Linux下面还是在BSD下面是一致的。

 

如下解说:

整个config文件里面只有#是注释

 

 

第一部分 General 属于基本配置。值得注意的地方有imgcache和imgurl这两个参数,要注意一下,和apache配置相关联,如果配置不好的话,打开web的时候图片会显示不出来。

 

*** General ***

owner    = KevinDeng

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 ... thisis not

# good for images.

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 是属于报警配置这个我还没有测试过。以后再说

 

*** Alerts ***

to = alertee@address.somewhere

from = smokealert@company.xy

+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=300pings=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.5144   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 ShenZhenWang Yu Company. \

         Hereyou 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 weare 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 with58e8b1b17440aa40fac67161b8c7a328 which does not match our expectation

ERROR: we did not get config from the master. Maybe weare 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 weare 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.orgignoring it

ERROR: we did not get config from the master. Maybe weare not configured as a slave for any of the targets on the master ?

A:

这个是指在config文件里面没有定义Nagios.kevinadmin.org这个从服务器

 

YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS