這個配置文件不管在Linux下面還是在BSD下面是一致的。
如下解說:
整個config文件裏面只有#是註釋
第一部分 General 屬於基本配置。值得注意的地方有imgcache和imgurl這兩個參數,要注意一下,和apache配置相關聯,如果配置不好的話,打開web的時候圖片會顯示不出來。
*** General ***
owner = Kevin Deng
contact = [email protected]
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 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
contact = [email protected]
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 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 是屬於報警配置, 這個我還沒有測試過。以後再說
+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
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 ?
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
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
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
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
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
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
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
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
height = 50
range = 10h
+ detail
width = 800
height = 200
height = 200
unison_tolerance = 2
"Last 3 Hours" 3h
"Last 30 Hours" 30h
"Last 10 Days" 10d
"Last 400 Days" 400d
"Last 30 Hours" 30h
"Last 10 Days" 10d
"Last 400 Days" 400d
+ hierarchies
++ owner
title = Host Owner
title = Host Owner
++ location
title = Location
title = Location
第五部分Porbes 指針配置,我們一般只用到fping所以就只要以下配置就可以了,確定路徑是否正確,這裏還可以設置fping包的大小,參數是packetsize
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
packetsize = 2000
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
#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
display_name = ShanTou Monitor
color = 0000ff
#location = HuanDong
+ fy
display_name = FuYong
color = 00ff00
display_name = FuYong
color = 00ff00
#++ override
#Probes.FPing.binary = /usr/bin/fping
#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.
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
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
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
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
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
#title =James
#alerts = someloss
#slaves = boomer slave2
#host = 192.168.0.205
++ QQ
++ MFS-Monitor
menu = MFS-Monitor
title = Monitor
host = 192.168.0.210
title = Monitor
host = 192.168.0.210
++ TaiWan
menu = TaiWan-Server
title = 229.84.216.201
host = 229.84.216.201
title = 229.84.216.201
host = 229.84.216.201
+ Monitor
menu = Monitor Servers
title = Monitor Server Hosts
title = Monitor Server Hosts
++ ShenZhen
menu = ShenZhen
title = SZ-Cacti
host = 192.168.0.208
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
#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
[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
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
[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的密碼,只需要一個密碼就可以了
這個錯誤就是本地的密碼文件配置錯誤,本地密碼文件只保存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
[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及對應的密碼就可以了。
在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這個從服務器