smokeping监控的redis 主从同步监控怎么配置

稳定性检测工具smokeping安装配置和使用方法 | Linux |
_数据库_运维_开发_IT学习_无忧IT学习网
一起学习!一起进步!
稳定性检测工具smokeping安装配置和使用方法
浏览: 991 views
smokeping是对IDC网络质量,稳定性等最好的检测工具,包括常规的 ping,dig,echoping,curl等,可以监视www服务器性能,监视dns查询性能,监视ssh性能等。底层也是 rrdtool 做支持,特点是画的图非常漂亮,网络丢包和延迟...
smokeping是对IDC质量,稳定性等最好的检测工具,包括常规的 ping,dig,echoping,curl等,可以监视www性能,监视dns查询性能,监视ssh性能等。底层也是 rrdtool 做支持,特点是画的图非常漂亮,丢包和延迟用颜色和阴影来表示。
smokeping的优点:
smokeping安装方法:使用yum安装其他资源包,编译安装smokeping方式。
一、使用apt.sw.be源(安装前的准备)
# yum update
# rpm -Uvh http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
使用yum安装,在 /etc/yum.repos.d/下面新建dag.repo文件在文件中输入源地址:
# cat dag.repo
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
# yum -y install rrdtool
这样就可以完成RRDTool安装&
二、软件包的安装(安装smokeping)
# yum install httpd
# yum install rrdtool
# yum install fping
# yum install echoping
# yum install curl
# yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-Radius perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI
# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz
# tar zxvf smokeping-2.4.2.tar.gz
# mv smokeping-2.4.1 /opt/smokeping
# cd /opt/smokeping/bin
# cp smokeping.dist smokeping
# cd ../htdocs/
# cp smokeping.cgi.dist smokeping.cgi
# cp tr.cgi.dist tr.cgi
# cd ../etc/
# cp config.dist config
# cp basepage.html.dist basepage.html
# cp smokemail.dist smokemail
# cp tmail.dist tmail
# cp smokeping_secrets.dist smokeping_secrets
# chmod 600 /opt/smokeping/etc/smokeping_secrets
三、配置smokeping
1. 编辑文件:/opt/smokeping/bin/smokeping
修改以下内容:
#!/usr/sepp/bin/perl-5.8.4 -w
# -*-perl-*-
use lib qw(/usr/pack/rrdtool-1.2.23-mo/lib/perl);
use lib qw(lib);
use Smokeping 2.004002;
Smokeping::main(&etc/config.dist&);
#!/usr/bin/perl -w
# -*-perl-*-
use lib qw(/usr/lib/perl5/vendor_perl/5.8.8/i386--thread-multi/auto/RRDs/);(注意:这个和编译安装的路径不同)
use lib qw(/opt/smokeping/lib);
use Smokeping 2.004002;
Smokeping::main(&/opt/smokeping/etc/config&);
2. 编辑文件:/opt/smokeping/htdocs/smokeping.cgi
修改以下内容:
#!/usr/sepp/bin/speedy -w
# -*-perl-*-
use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
use CGI::Carp qw(fatalsToBrowser);
use Smokeping 2.004002;
smokeping::cgi(&/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config&);
#!/usr/bin/speedy -w
# -*-perl-*-
use lib qw(/usr/lib/perl5/vendor_perl/5.8.8/i386--thread-multi/auto/RRDs);(这个和编译安装的也不相同)
use lib qw(/opt/smokeping/lib);
use CGI::Carp qw(fatalsToBrowser);
use Smokeping 2.004002;
Smokeping::cgi(&/opt/smokeping/etc/config&);
3. 编辑文件:/opt/smokeping/htdocs/tr.cgi
修改以下内容:
#!/usr/sepp/bin/speedy-5.8.8 -w
use lib qw(/home/oposs/smokeping/software/lib);
use lib qw(perl);
#!/usr/bin/speedy -w
use lib qw(/opt/smokeping/lib);
use lib qw(perl);
4. 编辑文件:/opt/smokeping/etc/basepage.html
修改以下内容:
&script src=&cropper/lib/prototype.js& type=&text/javascript&&&/script&
&script src=&cropper/lib/scriptaculous.js?load=builder,dragdrop& type=&text/javascript&&&/script&
&script src=&cropper/cropper.js& type=&text/javascript&&&/script&
&script src=&cropper/smokeping-zoom.js& type=&text/javascript&&&/script&
5. 修改traceroute权限
# chmod 4775 /bin/traceroute
6. 编辑配置文件(去掉AddHandler cgi-script .cgi前面的注释)
修改以下内容:
&script src=&cropper/lib/prototype.js& type=&text/javascript&&&/script&
&pre&&script src=&cropper/lib/scriptaculous.js?load=builder,dragdrop&&&/script&&/pre&
&pre&&script src=&cropper/cropper.js&&&/script&&/pre&
&script src=&cropper/smokeping-zoom.js& type=&text/javascript&&&/script&
&script src=&/smokeping/cropper/lib/prototype.js& type=&text/javascript&&&/script&
&script src=&/smokeping/cropper/lib/scriptaculous.js?load=builder,dragdrop& type=&text/javascript&&&/script&
&script src=&/smokeping/cropper/cropper.js& type=&text/javascript&&&/script&
&script src=&/smokeping/cropper/smokeping-zoom.js& type=&text/javascript&&&/script&
7. 编辑文件:/opt/smokeping/htdocs/tr.html
&meta http-equiv=&Content-Type& content=&text/ charset=utf-8& /&
&title&SmokeTrace&/title&
&script src=&/script/Tr.js&&&/script&
8. 编辑文件:/opt/smokeping/etc/config
*** General ***
owner = server1
contact = server1@de.net
mailhost = linuxde.net
sendmail = /usr/sbin/sendmail
imgcache = /opt/smokeping/htdocs/cache
imgurl = http://192.168.9.100/cache
datadir = /opt/smokeping/data
piddir = /opt/smokeping/var
cgiurl = http://192.168.9.100/smokeping/smokeping.cgi
smokemail = /opt/smokeping/etc/smokemail
tmail = /opt/smokeping/etc/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 ***
to = alertee@address.somewhere
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 = /opt/smokeping/etc/basepage.html
menu = Charts
title = The most interesting destinations
sorter = StdDev(entries=&4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
sorter = Max(entries=&5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
sorter = Loss(entries=&5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
sorter = Median(entries=&5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
width = 600
height = 200
unison_tolerance = 2
&Last 3 Hours& 3h
&Last 30 Hours& 30h
&Last 10 Days& 10d
&Last 400 Days& 400d
#+ hierarchies
#title = Host Owner
#++ location
#title = Location
*** Probes ***
binary = /usr/sbin/fping
*** Targets ***
menuextra = &a target='_blank' href='/smokeping/tr.html{HOST}' class='{CLASS}'
onclick=&window.open(this.href,this.target,
'width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no');
&&(TR)&/a&
probe = FPing
menu = Top
title = linuxde.net
remark = Welcome to linuxde.net
menu= Targets
++ linuxde.net
menu = linuxde.net
title = linuxde.net
alerts = someloss
host = linuxde.net
++ linuxde.net
menu = salogs.cm
title = linuxde.net
alerts = someloss
host = linuxde.net
9. 创建一个启动脚本
# vim /etc/init.d/smokeping
添加为以下内容:
#!/bin/bash
# chkconfig:
# Description: Smokeping init.d script
# Hacked by : How2CentOS - http://www.how2centos.com
# Get function from functions library
. /etc/init.d/functions
# Start the service Smokeping
echo -n &Starting Smokeping: &
/opt/smokeping/bin/smokeping &/dev/null 2&&1
### Create the lock file ###
touch /var/lock/subsys/smokeping
success $&Smokeping startup&
# Restart the service Smokeping
echo -n &Stopping Smokeping: &
kill -9 `ps ax | grep &/opt/smokeping/bin/smokeping& | grep -v grep | awk '{ print $1 }'` &/dev/null 2&&1
### Now, delete the lock file ###
rm -f /var/lock/subsys/smokeping
success $&Smokeping shutdown&
### main logic ###
case &$1& in
status Smokeping
restart|reload|condrestart)
echo $&Usage: $0 {start|stop|restart|reload|status}&
# chmod 755 /etc/init.d/smokeping
标签: , , , , ,
& | & & | & & | & & | & & | & & | & & | & & | & & | & & | & & | & & | & & | &
最热门文章
41302 views
11007 views
10001 views
6416 views
6018 views
4802 views
4123 views
4080 views
友情链接 |
本站进行129次查询扫一扫体验手机阅读
网络质量监控smokeping部署
b.安装依赖包
yum -y install httpd fping echoping curl
rrdtool perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-devel perl-FCGI.x86_64 perl-CGI.x86_64 rrdtool-perl.x86_64
c.有一个perl模块找不到rpm,用CPAN装上吧
wget http://search.cpan.org/CPAN/authors/id/D/DS/DSCHWEI/Config-Grammar-1.10.tar.gz
tar -zxvf Config-Grammar-1.10.tar.gz
cd Config-Grammar-1.10
perl Makefile.PL
make && make install
d.开始安装smokeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar -zxvf smokeping-2.6.9.tar.gz
cd smokeping-2.6.9
./configure
make && make install
e.初始化环境
cp /opt/smokeping-2.6.9/etc/config.dist
/opt/smokeping-2.6.9/etc/config
mkdir -p /opt/smokeping-2.6.9/cache
mkdir -p /opt/smokeping-2.6.9/data
mkdir -p /opt/smokeping-2.6.9/var
chmod 400 /opt/smokeping-2.6.9/etc/smokeping_secrets.dist
#这个密钥用于master与slaves验证用,后面会说
chown apache.apache /opt/smokeping-2.6.9/etc/smokeping_secrets.dist
chown apache.apache -R /opt/smokeping-2.6.9/
f.配置apache
vim /etc/httpd/conf.d/smokeping.conf
Alias /smokeping/cache/ /opt/smokeping-2.6.9/cache/
Alias /smokeping/ /opt/smokeping-2.6.9/htdocs/
&Directory /opt/smokeping-2.6.9/htdocs/&
Allow from all
Options ExecCGI
AddHandler cgi-script .fcgi
&IfModule dir_module&
DirectoryIndex smokeping.fcgi
&/IfModule&
&/Directory&
g.单节点的部署完了,测试跑一下
/etc/init.d/httpd start
sudo -u apache /opt/smokeping-2.6.9/bin/smokeping
2.部署master/slaves
现在开始部署分布式监控
需要注意以下几点:
1)smokeping的slaves机器不需要配置httpd且不需要配置文件,它会去master上取。
2)master与slaves需要通过校验文件校验
3)master的httpd进程必须与smokeping进程是相同的启动用户(在本文用apache用户)。不然会出现slaves采集的数据,一直不会更新rrd.图上一直是Nan
a.master端
1)在master上添加配置,添加以下内容到配置文件
/opt/smokeping-2.6.9/etc/config
*** Slaves ***
#此文件就是校验文件
secrets=/opt/smokeping-2.6.9/etc/smokeping_secrets.dist
+ 节点的hostname
display_name=节点的hostname
location=China
color=0000ff
2)生成master校验文件
vim /opt/smokeping-2.6.9/etc/smokeping_secrets.dist
节点的hostname:密钥
3)重启smokeping服务
b.在slaves端
和master一样安装包和初始化环境,这里就不重复了
1)生成slaves的校验文件
echo &上面master校验文件中定义的密钥& & /opt/smokeping-2.6.9/etc/slave_secret.txt
chmod 400 /opt/smokeping-2.6.9/etc/slave_secret.txt
2)启动slaves服务
slaves的hostname必须与master校验文件和配置文件中的对上
/opt/smokeping-2.6.9/bin/smokeping --master-url=http://你的masterIP/smokeping/smokeping.fcgi --shared-secret=/opt/smokeping-2.6.9/etc/slave_secret.txt --cache-dir=/opt/smokeping-2.6.9/cache/
master的配置文件参考
cat /opt/smokeping-2.6.9/etc/config
# This Smokeping example configuration file was automatically generated.
# Everything up to the Probes section is derived from a common template file.
# See the Probes and Targets sections for the actual example.
# This example is included in the smokeping_examples document.
*** General ***
mailhost = 127.0.0.1
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 = /opt/smokeping-2.6.9/cache
= /opt/smokeping-2.6.9/data
= /opt/smokeping-2.6.9/var
= http://http://yoururl/smokeping.cgi
smokemail = /opt/smokeping-2.6.9/etc/smokemail.dist
tmail = /opt/smokeping-2.6.9/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 ***
type = loss
# in percent
pattern = &0%,*12*,&0%,*12*,&0%
comment = loss 3 times
type = rtt
# in milliseconds
pattern = ==S,&50,&50
comment = route
+rttdetect
type = rtt
# in milliseconds
pattern = &10,&10,&10,&10,&10,&100,&100,&100,&100
comment = routing messed up again ?
*** Database ***
# consfn mrhb steps total
*** Presentation ***
template = /opt/smokeping-2.6.9/etc/basepage.html.dist
charset = utf-8
menu = Charts
title = The most interesting destinations
sorter = StdDev(entries=&4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
sorter = Max(entries=&5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
sorter = Loss(entries=&5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
sorter = Median(entries=&5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
width = 600
height = 200
unison_tolerance = 2
&Last 3 Hours&
&Last 30 Hours&
&Last 10 Days&
&Last 400 Days&
#+ hierarchies
#title = Host Owner
#++ location
#title = Location
# (The actual example starts here.)
*** Probes ***
# Here we have just one probe, fping, pinging four hosts.
# The fping probe is using the default parameters, some of them supplied
# from the Database section (&step& and &pings&), and some of them by
# the probe module.
binary = /usr/sbin/fping
*** Targets ***
# The hosts are located in two sites of two hosts each, and the
# configuration has been divided to site sections ('+') and host subsections
# ('++') accordingly.
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to this SmokePing website.
alerts = rttbad,someloss
###################东莞VPN配置#########################
menu = 东莞VPN
title = 东莞VPN
host = /DG_VPN/DG_VPN1/To_ZW_1~dg.vpn1 /DG_VPN/DG_VPN1/To_ZW_2~dg.vpn1 /DG_VPN/DG_VPN1/To_SD~dg.vpn1 /DG_VPN/DG_VPN2/To_ZW_1~dg.vpn2 /DG_VPN/DG_VPN2/To_ZW_2~dg.vpn2 /DG_VPN/DG_VPN2/To_SD~dg.vpn2
++ DG_VPN1
nomasterpoll=yes
menu = 东莞VPN1
title = 东莞VPN1
#这里就是应用dg.vpn1这个slaves去做监控
slaves = dg.vpn1
host = /DG_VPN/DG_VPN1/To_ZW_1~dg.vpn1 /DG_VPN/DG_VPN1/To_ZW_2~dg.vpn1 /DG_VPN/DG_VPN1/To_SD~dg.vpn1
+++ To_ZW_1
menu = 去往兆维线路1
title = 去往兆维线路1
host = 192.168.200.1
+++ To_ZW_2
menu = 去往兆维线路2
title = 去往兆维线路2
host = 192.168.201.1
menu = 去往上地线路
title = 去往上地线路
host = 192.168.202.1
++ DG_VPN2
nomasterpoll=yes
menu = 东莞VPN2
title = 东莞VPN2
slaves = dg.vpn2
host = /DG_VPN/DG_VPN2/To_ZW_1~dg.vpn2 /DG_VPN/DG_VPN2/To_ZW_2~dg.vpn2 /DG_VPN/DG_VPN2/To_SD~dg.vpn2
+++ To_ZW_1
menu = 去往兆维线路1
title = 去往兆维线路1
host = 192.168.200.1
+++ To_ZW_2
menu = 去往兆维线路2
title = 去往兆维线路2
host = 192.168.201.1
menu = 去往上地线路
title = 去往上地线路
host = 192.168.202.1
*** Slaves ***
secrets=/opt/smokeping-2.6.9/etc/smokeping_secrets.dist
display_name=dg.vpn1
location=China
color=000fff
display_name=dg.vpn2
location=China
color=000ff1
++override
Probes.FPing.binary = /usr/sbin/fping
smokeping页面和rrd图片支持中文
默认不支持中文,不过修改也很简单
1.页面支持中文
在配置文件的*** Presentation ***下添加
charset = utf-8
2.rrd图片支持中文
yum -y install wqy-zenhei-fonts.noarch
修改配置文件/opt/smokeping-2.6.9/lib/Smokeping/Graphs.pm ,插入这句'--font TITLE:20:&WenQuanYi Zen Hei Mono&',
my ($graphret,$xs,$ys) = RRDs::graph
'--start', $tasks[0][1],
'--end', $tasks[0][2],
'--font TITLE:20:&WenQuanYi Zen Hei Mono&',
&DEF:maxping=$cfg-&{General}{datadir}${host}.rrd:median:AVERAGE&,
'PRINT:maxping:MAX:%le' );
<span type="1" blog_id="1265606" userid='
分享到朋友圈
关注作者,不错过每一篇精彩Debian Nginx涓奡mokpeing涓讳粠鍒嗗竷寮忛儴缃叉枃妗}

我要回帖

更多关于 smokeping 主从 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信