注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

涅槃

文档收藏

 
 
 

日志

 
 
 
 

Smokeping 高级配置  

2013-05-31 16:51:34|  分类: 系统监控 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
标签:休闲 blank 职场
  4.1 监控节点的增加

++ TEST

menu = TEST

title = TEST

################web server############################

+++ TEST-web-bbs

menu = TEST-web-bbs

title = TEST网站 10.0.100.10

host = 61.160.248.10

+++ TEST-web-main

menu = TEST网站主WEB服务器

title = TEST网站主WEB服务器 10.0.100.21

host = 10.0.100.21

+++ TEST-web-admin

menu = TEST网站后台管理WEB服务器

title = TEST网站后台管理WEB服务器 10.0.100.6

host = 10.0.100.6

################double line server############################

+++ TEST-web-static

menu = TEST双线官网和网站静态文件WEB服务器

title = TEST双线官网和网站静态文件WEB服务器

#host = /cy2009/TEST/TEST-web-static-union \

# /TEST/TEST-web-static-telecom

++++ TEST-web-static-telecom

menu = TEST电信官网和网站静态文件WEB服务器

title = TEST电信官网和网站静态文件WEB服务器 10.0.100.101

host = 10.0.100.101

++++ TEST-web-static-union

menu = TEST网通官网和网站静态文件WEB服务器

title = TEST网通官网和网站静态文件WEB服务器 10.0.100.159

host = 10.0.100.159

################database############################

+++ TEST-db-master

menu = TEST网站DB主服务器

title = TEST网站DB主服务器 10.0.100.7

host = 10.0.100.7

+++ TEST-db-slave

menu = TEST网站DB从服务器

title = TEST网站DB从服务器 10.0.100.11

host = 10.0.100.11

################other############################

+++ TEST-memcached

menu = TEST-memcached服务器

title = TEST memcached和SVN服务器 10.0.100.22

host =10.0.100.22

4.2 报警设置

smokeping的alert设置有点复杂,但是却很好用,设置很灵活,考虑得很周全。它可以使用邮件进行alert,也可以直接调用外部程序进行IM的报警。在我们的监控中主要是采用邮件报警。考虑到清河东链路的实时性要求很高,我们采用了发送邮件到139邮箱,139邮箱再转发短信到手机上从而达到短信报警功能。 报警参数设置如下,哪个节点需要报警增加alerts = manyloss即可

*** Alerts ***

to = zouyunhao@aspire-tech.com,minliang@aspire-tech.com,

from = smokealert@192.168.2.14

+someloss

type = loss

pattern = >0%,*30*,>0%,*30*,>0% # in percent

comment = loss 1 packages in 30 continuous 3 times.

+manyloss type = loss

pattern = >15%,*30*,>15%,*30*,>15% # in percent

comment = loss 5 packages in 30 continuous 3 times.

+rttbad type = rtt

pattern = ==S,>50,>50 # in milliseconds

comment = For more than two consecutive 50-millisecond delay.

(1)to 表示接受所有报警的邮箱,如果需要在特定的节点报警发送到特定的邮箱

则在该节点上增加alertee = 13828466531@139.com即可。

(2)manyloss 表示30个包丢15%的情况 连续出现3次就发报警。

(3)someloss 表示30个包丢1个,连续出现3次就发送报警;rttbad表示连续两个包延迟超过50ms就发送报警。

4.3 画图设置

Smokeping默认设置中是每5分钟画一次图,每5分钟发送20个ping包。网络工程师认为5分钟发送20个ping包太少,建议改为5分钟100个。画图的颜色等也要进行相应的更改: 在Database中,step =300 pings =20 改为 step = 300 pings =100

4.4 Master/slave模式

clip_image002

从图上可以看到,slave主机会自己去检查监测点的情况(loss and rtt),并将数值提交给master主机(通过smokeping.cgi)。值得注意的是,slave并不需要config文件,每次slave提交完数据以后,会询问master它自己的配置文件是否有修改,如果有修改的话slave会进行更新。

Master配置:

*** Probes ***

+ FPing

binary = /usr/sbin/fping

sourceaddress = 0.0.0.0

*** Slaves ***

secrets=/usr/local/smokeping/etc/smokeping_secrets.dist

+10.0.100.146

display_name=10.0.100.146

location=tangshan

color=ff0000

++override

Probes.FPing.binary = /usr/sbin/fping

Probes.FPing.sourceaddress = 10.0.100.146 #唐山电信线路

+10.0.101.146

display_name=10.0.101.146

location=tangshan

color=ffff00

++override

Probes.FPing.binary = /usr/sbin/fping

Probes.FPing.sourceaddress = 10.0.101.146 #唐山网通线路

+10.0.100.93

display_name=10.0.100.93

location=zhongshan

color=ff0000

++override

Probes.FPing.binary = /usr/sbin/fping

Probes.FPing.sourceaddress = 10.0.100.93 #中山电信线路

+10.0.100.125

display_name=10.0.100.125

location=zhongshan

color=ffff00

++override

Probes.FPing.binary = /usr/sbin/fping

Probes.FPing.sourceaddress = 10.0.100.125 #中山网通线路

Slave配置:

Slave安装好软件后配置文件无需改动,只需运行一个命令即可。

Slave1配置:

#中山网通线路配置:

mkdir -p /usr/local/smokeping/cache-wt

smokeping --master-url=http://10.0.100.8/smokeping/smokeping.cgi \

--cache-dir=/usr/local/smokeping/cache-wt \

--shared-secret=/usr/local/smokeping/etc/smokeping_secrets.dist --slave-name=10.0.100.125 \

#中山电信线路配置:

mkdir -p /usr/local/smokeping/cache-dx

smokeping --master-url=http://10.0.100.8/smokeping/smokeping.cgi \

--cache-dir=/usr/local/smokeping/cache-dx \

--shared-secret=/usr/local/smokeping/etc/smokeping_secrets.dist --slave-name=10.0.100.93 \

chown -R apache.apache /usr/local/smokeping

Slave2配置:

#唐山网通线路配置:

mkdir -p /usr/local/smokeping/cache-wt

smokeping --master-url=http://10.0.100.8/smokeping/smokeping.cgi \

--cache-dir=/usr/local/smokeping/cache-wt \

--shared-secret=/usr/local/smokeping/etc/smokeping_secrets.dist --slave-name=10.0.101.146 \

#唐山电信线路配置:

mkdir -p /usr/local/smokeping/cache-dx

smokeping --master-url=http://10.0.100.8/smokeping/smokeping.cgi \

--cache-dir=/usr/local/smokeping/cache-dx \

--shared-secret=/usr/local/smokeping/etc/smokeping_secrets.dist --slave-name=10.0.100.146 \

chown -R apache.apache /usr/local/smokeping

4.5 Traceroute配置

在配置文件中加入对traceroute的支持

*** Targets ***

probe = FPing

menu = Top

title = Network Latency Grapher

+ TESTN

menu= TESTN_smokeping

title = TESTN Network Latency Grapher

menuextra = <a target='_blank' href=\'#\'" class='{CLASS}'onclick="window.open(this.href,this.target, '>

,toolbar=no,location=no,status=no,scrollbars=no'); return false;">*traceroute*</a>




Centos下smokeping的安装配置

环境:

CentOS+rrdtool+smokeping实现网络监控

前提软件需求:

freetype-devel-2.1.9-1.i386.rpm

zlib-devel-1.2.1.2-1.i386.rpm

libpng-devel-1.2.7-1.i386.rpm

libart_lgpl-devel-2.3.16-3.i386.rpm

        fping

CGI-SpeedyCGI-2.22.tar.gz

系统需求:

1安装 fping

64位 wget http://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.x86_64.rpm

32位 wget http://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.i386.rpm

2 安装CGI-SpeedyCGI

wget http://daemoninc.com/SpeedyCGI/CGI-SpeedyCGI-2.22.tar.gz

tar zxvf CGI-SpeedyCGI-2.22.tar.gz

cd CGI-SpeedyCGI-2.22

perl Makefile.PL

make

make test

make install

3 安装rrdtool

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.26.tar.gz

tar zxvf rrdtool-1.2.26.tar.gz

cd rrdtool-1.2.26

./configure --prefix=/usr/local/rrdtool

make

make install

4 安装smokeping

wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz

tar zxvf smokeping-2.4.2.tar.gz

ln -s smokeping-2.4.2 smokeping

5 配置smokeping

首先建立两个目录:

mkdir /usr/local/smokeping/cache

mkdir /usr/local/smokeping/var

chown apache.apache /usr/local/smokeping/cache /usr/local/smokeping/var

然后修改如下几个配置文件:

(1) /usr/local/smokeping/etc/config.dist

imgcache = /usr/local/smokeping/cache

imgurl   = ../cache

datadir = /usr/local/smokeping/var

piddir = /usr/local/smokeping/var

cgiurl   = http://smokeping.sso.cn/htdocs/smokeping.cgi

smokemail = /usr/local/smokeping/etc/smokemail.dist

tmail = /usr/local/smokeping/etc/tmail.dist

template = /usr/local/smokeping/etc/basepage.html.dist

注释掉如下:(2.42新版本下不用注释也行)

#*** Slaves ***

#secrets=/usr/local/smokeping/etc/smokeping_secrets.dist

#+boomer

#display_name=boomer

#color=0000ff

#+slave2

(2) /usr/local/smokeping/htdocs/smokeping.cgi

首先,cp smokeping.cgi.dist smokeping.cgi   //生成smokeping.cgi

#!/usr/bin/speedy -w

use lib qw(/usr/local/rrdtool/lib/perl);

use lib qw(/usr/local/smokeping/lib);

Smokeping::cgi("/usr/local/smokeping/etc/config.dist");

(3) /usr/local/smokeping/bin/smokeping.dist

#!/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.dist");

(4) 启动smokeping

/usr/local/smokeping/bin/smokeping.dist start

(5) 建立启动脚本文件

参照:http://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script

(6) 配置apache/conf/httpd.conf

<VirtualHost *:80>

    DocumentRoot /usr/local/smokeping

    ServerName smokeping.sso.cn

    AddHandler cgi-script .cgi

<Directory "/usr/local/smokeping/htdocs/">

        AllowOverride None

        Options ExecCGI Indexes

        Order allow,deny

        Allow from all

    </Directory>

    ErrorLog logs/ping-error_log

    CustomLog logs/ping-access_log common

</VirtualHost>

(7) 安装完成,可以通过如下链接看到效果:

http://smokeping.sso.cn/htdocs/smokeping.cgi

参考:

http://oss.oetiker.ch/smokeping/

/usr/local/smokeping/htdocs/doc/smokeping_config.html

/usr/local/smokeping/doc/examples/

附:config.dist 
*** General ***

owner    = Peter Random
contact = 
mailhost = my.mail.host
#sendmail = /usr/lib/sendmail
imgcache = /usr/local/smokeping/cache
imgurl   = ../cache
datadir = /usr/local/smokeping/var
piddir = /usr/local/smokeping/var
cgiurl   = http://smokeing.titan24.com/htdocs/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 ***
to = 
from =

+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row

*** Database ***

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   720
    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 = Stdandard 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

*** Probes ***

+ FPing

binary = /usr/sbin/fping

#*** Slaves ***
#secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#+slave2

*** 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.


+ CNC

menu = CNC
title = CNC

++ xizang
menu = xizang
title = xizang
host = 221.13.80.14

++ shanxi_wt
menu = shanxi
title = shanxi_wt
host = 221.11.66.1

++ beijing
menu = beijing
title = beijing
host = 202.99.57.149

++ tianjin
menu = tianjin
title = tianjin
host = 218.69.32.6

++ shijiazhuang
menu = shijiazhuang
title = shijiazhuang
host = 202.99.160.234

++ shanxi
menu = shanxi
title = shanxi
host = 218.26.125.150

++ neimenggu
menu = neimenggu
title = neimenggu
host = 202.99.226.58

++ heilongjiang
menu = heilongjiang
title = heilongjiang
host = 61.138.38.114

++ jilin
menu = jilin
title = jilin
host = 125.32.127.14

++ liaoning
menu = liaoning
title = liaoning
host = 218.61.254.174

++ shandong
menu = shandong
title = shandong
host = 60.215.136.234

++ henan
menu = henan
title = henan
host = 61.168.254.26

+ TELCOM

menu = telcom
title = telcom

++ beijing_dx
menu = beijing_dx
title = beijing_dx
host = 218.30.66.57


++ shanghai_dx
menu = shanghai_dx
title = shanghai_dx
host = 202.101.63.193

++ jiangsu_dx
menu = jiangsu_dx
title = jiangsu_dx
host = 61.147.37.1

++ zhejiang_dx
menu = zhejiang_dx
title = zhejiang_dx
host = 220.191.129.118

++ anhui_dx
menu = anhui_dx
title = anhui_dx
host = 61.190.251.38

++ wenzhou_dx
menu = wenzhou_dx
title = wenzhou_dx
host = 202.97.40.86

++ jiangxi_dx
menu = jiangxi_dx
title = jiangxi_dx
host = 220.177.252.94

++ hubei_dx
menu = hubei_dx
title = hubei_dx
host = 221.232.254.62

++ hunan_dx
menu = hunan_dx
title = hunan_dx
host = 61.137.2.14

++ guangdong_dx
menu = guangdong_dx
title = guangdong_dx
host = 61.144.3.13

++ hainan_dx
menu = hainan_dx
title = hainan_dx
host = 59.50.32.70

++ guangxi_dx
menu = guangxi_dx
title = guangxi_dx
host = 218.65.136.2

++ chongqing_dx
menu = chongqing_dx
title = chongqing_dx
host = 219.153.16.97

++ sichuan_dx
menu = sichuan_dx
title = sichuan_dx
host = 218.6.196.70

++ guizhou_dx
menu = guizhou_dx
title = guizhou_dx
host = 219.151.0.142

++ yunnan_dx
menu = yunnan_dx
title = yunnan_dx
host = 222.221.1.30

  评论这张
 
阅读(1952)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018