SmokePing之配置文件config詳解

SmokePing之配置文件config詳解
這個配置文件無論在Linux下面仍是在BSD下面是一致的。

以下解說:
整個config文件裏面只有[color=#ff0000]#[/color]是[color=#ff0000][b]註釋[/b][/color]


第一部分 General 屬於基本配置。值得注意的地方有imgcache和imgurl這兩個參數,要注意一下,和apache配置相關聯,若是配置很差的話,打開web的時候圖片會顯示不出來。

*** General ***
owner    = test
contact  =
[email=***@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   =
[url=http://192.168.0.206/smokeping/smokeping.cgi]http://192.168.0.206/smokeping/smokeping.cgi[/url]
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 =
[email=alertee@address.somewhere]alertee@address.somewhere[/email]
from =
[email=smokealert@company.xy]smokealert@company.xy[/email]
+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 = 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    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 =
[url=http://www.qq.com]www.qq.com[/url]
host =
[url=http://www.qq.com]www.qq.com[/url]

++ MFS-Monitor
menu = MFS-Monitor
title = Monitor
host = 192.168.0.210

++ TaiWan
menu = TaiWan-Server
title = 229.84.216.221
host = 229.84.216.221

+ 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這個從服務器

by kevin
 html

相關文章
相關標籤/搜索