转载自http://hi.baidu.com/yifan1018/blog/item/e1e1c92a7ec61295023bf6a9.html
【实际需求】
做为网站公司一般都会要求我们 IT 部提供全国各地 IDC 网络速度如何?质量?稳定性等等?
一般 ISP 或者代理公司会给出测试服务器供我们测试该 IDC 的网络情况如何?
比如 windows 服务器中有雷傲测试工具等等、就是通过在高峰时间段 ping 各地区的信息港或者骨干网络的 IP 地址;最后分析统计该时间段内的 ping 值数据的平均值和丢包率等;
===================================================================================SmokePing
做为网站公司一般都会要求我们 IT 部提供全国各地 IDC 网络速度如何?质量?稳定性等等?
一般 ISP 或者代理公司会给出测试服务器供我们测试该 IDC 的网络情况如何?
比如 windows 服务器中有雷傲测试工具等等、就是通过在高峰时间段 ping 各地区的信息港或者骨干网络的 IP 地址;最后分析统计该时间段内的 ping 值数据的平均值和丢包率等;
===================================================================================SmokePing
【Smokeping 简介】
是 rrdtool 的作者 Tobi Oetiker 的作品,所以它在图形显示方面有很大优势,也是一个很有特点的 opensource 工具:
多种探测方式,包括 fping、echoping、dig、curl 等;
易用可扩展的插件;
master/slave 的工作方式,可以在多个节点收集同一个监测点的数据;
很有特色的 alert 设置,不只是简单的设置一个阀值。
===================================================================================
【系统配置 RHEL-5.3】
关闭 防火墙
# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
关闭 selinux
# system-config-selinux
或
# setenforce 0
或
# vi /etc/sysconfig/selinux
将 SELINUX= enforcing
改成 SELINUX= disabled
重启后生效
===================================================================================
【安装相关软件】
smokeping 是一个用 perl 写的程序,所以不需要安装。但是他需要使用一些工具以及 perl 的 module,还有 rrdtool、fping、echoping 等,这些都需要预先安装好。smokeping 启动的时候,也会自己去检查需要用到的程序是否能找到。
我已经配置好了 yum :
# yum install gcc
# yum install freetype-devel
# yum install zlib-devel
# yum install libpng-devel
# yum install libart_lgpl-devel
# yum install httpd-devel
# yum install apr-util-devel
# yum install apr-devel
# yum install perl*
# yum install gcc freetype-devel zlib-devel libpng-devel libart_lgpl-devel httpd-devel apr-util-devel apr-devel freetype libart_lgpl libpng zlib perl*
除了以上的 rpm 包,还需手动安装以下的包。
【rrdtool】【cgilib】【fping-2.4b2_to】【echoping】【CGI-SpeedyCGI-2.22】【smokeping】
===================================================================================
【rrdtool】
rrdtool 依赖以下程序
# yum install freetype
# yum install libart_lgpl
# yum install libpng
# yum install zlib
# yum install freetype libart_lgpl libpng zlib
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.6.tar.gz
# tar zxvf rrdtool-1.3.6.tar.gz
# cd rrdtool-1.3.6
# ./configure --disable-tcl
多种探测方式,包括 fping、echoping、dig、curl 等;
易用可扩展的插件;
master/slave 的工作方式,可以在多个节点收集同一个监测点的数据;
很有特色的 alert 设置,不只是简单的设置一个阀值。
===================================================================================
【系统配置 RHEL-5.3】
关闭 防火墙
# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
关闭 selinux
# system-config-selinux
或
# setenforce 0
或
# vi /etc/sysconfig/selinux
将 SELINUX= enforcing
改成 SELINUX= disabled
重启后生效
===================================================================================
【安装相关软件】
smokeping 是一个用 perl 写的程序,所以不需要安装。但是他需要使用一些工具以及 perl 的 module,还有 rrdtool、fping、echoping 等,这些都需要预先安装好。smokeping 启动的时候,也会自己去检查需要用到的程序是否能找到。
我已经配置好了 yum :
# yum install gcc
# yum install freetype-devel
# yum install zlib-devel
# yum install libpng-devel
# yum install libart_lgpl-devel
# yum install httpd-devel
# yum install apr-util-devel
# yum install apr-devel
# yum install perl*
# yum install gcc freetype-devel zlib-devel libpng-devel libart_lgpl-devel httpd-devel apr-util-devel apr-devel freetype libart_lgpl libpng zlib perl*
除了以上的 rpm 包,还需手动安装以下的包。
【rrdtool】【cgilib】【fping-2.4b2_to】【echoping】【CGI-SpeedyCGI-2.22】【smokeping】
===================================================================================
【rrdtool】
rrdtool 依赖以下程序
# yum install freetype
# yum install libart_lgpl
# yum install libpng
# yum install zlib
# yum install freetype libart_lgpl libpng zlib
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.6.tar.gz
# tar zxvf rrdtool-1.3.6.tar.gz
# cd rrdtool-1.3.6
# ./configure --disable-tcl
----------------------------------------------------------------
Config is DONE!
With MMAP IO: yes
Build rrd_getopt: no
Static programs: no
Perl Modules: perl_piped perl_shared
Perl Binary: /usr/bin/perl
Perl Version: 5.8.8
Perl Options: PREFIX=$(DESTDIR)/usr/local/rrdtool-1.3.6 LIB=$(DESTDIR)/usr/local/rrdtool-1.3.6/lib/perl/5.8.8
Ruby Modules:
Ruby Binary: no
Ruby Options: sitedir=$(DESTDIR)/usr/local/rrdtool-1.3.6/lib/ruby
Build Tcl Bindings: no
Build Python Bindings: yes
Build rrdcgi: yes
Build librrd MT: yes
Link with libintl: yes
Libraries: -lxml2 -lcairo -lcairo -lcairo -lm -lcairo -lpng12 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
Type 'make' to compile the software and use 'make install' to
install everything to: /usr/local/rrdtool-1.3.6.
... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.
-- Tobi Oetiker
----------------------------------------------------------------
# make
# make install
# whereis rrdtool
rrdtool: /usr/local/rrdtool
完成后执行cd ..退回安装包的目录
------------------------------------------------------------------------------------------------------------------------------------
【cgilib】
# wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz
# tar zxvf cgilib-0.5.tar.gz
# cd cgilib-0.5
# make
# cp libcgi.a /usr/local/lib
# cp cgi.h /usr/include
Config is DONE!
With MMAP IO: yes
Build rrd_getopt: no
Static programs: no
Perl Modules: perl_piped perl_shared
Perl Binary: /usr/bin/perl
Perl Version: 5.8.8
Perl Options: PREFIX=$(DESTDIR)/usr/local/rrdtool-1.3.6 LIB=$(DESTDIR)/usr/local/rrdtool-1.3.6/lib/perl/5.8.8
Ruby Modules:
Ruby Binary: no
Ruby Options: sitedir=$(DESTDIR)/usr/local/rrdtool-1.3.6/lib/ruby
Build Tcl Bindings: no
Build Python Bindings: yes
Build rrdcgi: yes
Build librrd MT: yes
Link with libintl: yes
Libraries: -lxml2 -lcairo -lcairo -lcairo -lm -lcairo -lpng12 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
Type 'make' to compile the software and use 'make install' to
install everything to: /usr/local/rrdtool-1.3.6.
... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.
-- Tobi Oetiker
----------------------------------------------------------------
# make
# make install
# whereis rrdtool
rrdtool: /usr/local/rrdtool
完成后执行cd ..退回安装包的目录
------------------------------------------------------------------------------------------------------------------------------------
【cgilib】
# wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz
# tar zxvf cgilib-0.5.tar.gz
# cd cgilib-0.5
# make
# cp libcgi.a /usr/local/lib
# cp cgi.h /usr/include
cglib是一个强大的,高性能,高质量的Code生成类库。它可以在运行期扩展Java类与实现Java接口。
cglib封装了asm,可以在运行期动态生成新的class。cglib用于AOP,jdk中的proxy必须基于接口,cglib却没有这个限制。cglib项目主页 | http://cglib.sourceforge.net/
------------------------------------------------------------------------------------------------------------------------------------
【fping-2.4b2_to】
# wget http://fping.sourceforge.net/download/fping.tar.gz
# tar zxvf fping.tar.gz
# cd fping-2.4b2_to
# ./configure
# make
# make check
# make install
# whereis fping
fping: /usr/local/sbin/fping
------------------------------------------------------------------------------------------------------------------------------------
【echoping】
# wget http://jaist.dl.sourceforge.net/project/echoping/echoping/6.0.0/echoping-6.0.0.tar.gz
# tar zxvf echoping-6.0.0.tar.gz
# cd echoping-6.0.0
# ./configure
# make
# make test
遇到测试不成功等信息就 ctrl+c 回到命令行;
# make install
# whereis echoping
echoping: /usr/local/bin/echoping /usr/local/lib/echoping
------------------------------------------------------------------------------------------------------------------------------------
【CGI-SpeedyCGI-2.22】
# 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
Optional mod_speedycgi support.
Mod_speedycgi increases performance under Apache by avoiding the fork/exec
overhead associated with each request under normal SpeedyCGI. However, it
requires a working copy of "apxs" in your path, Apache with mod_so
support, and additional Apache configuration.
Compile mod_speedycgi (default no)? n
遇到问题选择默认选项( no)
# ls /etc/httpd/modules/
libphp5.so mod_cgid.so mod_include.so mod_proxy.so
……
mod_cern_meta.so mod_imap.so mod_proxy_http.so
这个目录下没有 mod_speedycgi.so,现在需要去下载安装 mod_speedycgi.so
搜到了一个源
# wget ftp://195.220.108.108/linux/epel/5/i386/mod_speedycgi-2.22-4.el5.i386.rpm
# rpm -ivh mod_speedycgi-2.22-4.el5.i386.rpm
warning: mod_speedycgi-2.22-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
error: Failed dependencies:
perl-CGI-SpeedyCGI = 2.22-4.el5 is needed by mod_speedycgi-2.22-4.el5.i386
# wget ftp://fr.rpmfind.net/linux/EPEL/5Server/i386/perl-CGI-SpeedyCGI-2.22-4.el5.i386.rpm
# rpm -ivh --force perl-CGI-SpeedyCGI-2.22-4.el5.i386.rpm
# rpm -ivh mod_speedycgi-2.22-4.el5.i386.rpm
# perl Makefile.PL
# make
# make test
# make install
完成后执行 cd ..退回安装包的目录
===================================================================================
三、配置 【smokeping】
① 下载、解压文件
# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.3.6.tar.gz
# tar zxvf smokeping-2.3.6.tar.gz
# mv smokeping-2.3.6 / smokeping
# cd / smokeping /smokeping-2.3.6
------------------------------------------------------------------------------------------------------------------------------------
② 生成文件
bin/ 下的 smokeping.dist
# cp smokeping.dist smokeping
etc/ 下的 basepage.html.dist,config.dist,smokemail.dist
# cp basepage.html.dist basepage.html
# cp config.dist config
# cp smokemail.dist smokemail
# chmod 600 smokeping_secrets.dist
htdocs/smokeping.cgi.dist
# cp smokeping.cgi.dist smokeping.cgi
/etc/ 下的 config-echoping.dist 可以先不去掉.dist;
------------------------------------------------------------------------------------------------------------------------------------
③ 按下面的步骤改参数:
配置 bin/smokeping
# vi /smokeping/smokeping-2.3.6/bin/ smokeping
主程序,运行在后台。
在这个文件里面我们需要修改前面两个 lib 和后面 config 文件的 path。
两个 lib 分别是 smokeping 的 lib 和 rrdtool 的 lib 。
我的 smokeping 安装在 /usr/local/ 目录中,所以我的设置是:
将以下几行替换为已经安装的相关软件的路径(将 橙×××改为 浅×××):
#!/usr/sepp/bin/perl-5.8.4 -w
#!/usr/bin/perl -w
use lib qw(/usr/pack/rrdtool-1.2.23-mo/lib/perl);
use lib qw( /usr/local/rrdtool-1.3.6/lib/perl );
use lib qw(lib);
use lib qw(/smokeping/smokeping-2.3.6/lib);
use Smokeping 2.003006;
Smokeping::main("etc/config.dist");
Smokeping::main("/smokeping/smokeping-2.3.6/etc/config");
配置 htdocs/smokeping.cgi
# vi /smokeping /smokeping-2.3.6/htdocs/smokeping.cgi
这个文件显示页面、图像和作为 slave 传输数据的接口,设置方法与"bin/smokeping"类似。
但是第一行的 speedy 的路径可能需要修改,否则浏览器中只会看到一个白色的页面。
将以下几行替换为已经安装的相关软件的路径(将 橙×××改为 浅×××):
#!/usr/sepp/bin/speedy -w
# -*-perl-*-
#!/usr/bin/speedy -w
# -*-perl-*-
# use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
use lib qw(/usr/local/rrdtool-1.3.6/lib/perl/);
# use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
use lib qw( / smokeping /smokeping-2.3.6/ lib);
use Smokeping 2.003006;
Smokeping::cgi("/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config");
Smokeping::cgi("/ smokeping /smokeping-2.3.6/etc/config");
配置 htdocs/cropper/*
用来作页面图像放大缩小的工具。
配置 etc/basepage.html
显示页面的主框架。里面之需要配置"htdocs/cropper/"的位置即可。
配置 etc/config
# vi /smokeping/smokeping-2.3.6/etc/config
(config 默认是只读的,需要修改属性)
将以下几行替换为已经安装的相关软件的路径(将 橙×××改为 浅×××):
*** General ***
owner = Peter Random
owner = qu6zhi.test (输入您的名字,显示在网页上)
contact = [email protected]
contact = user@domain (输入您的邮件,显示在网页上)
imgcache = /home/oetiker/public_html/smokeping-ms/cache
imgcache = /smokeping/smokeping-2.3.6/htdocs/cache
imgurl = cache
imgurl = cache
datadir = /tmp/smokeping-ms/data
datadir = /smokeping/smokeping-2.3.6/var
piddir = /tmp/smokeping-ms/var
piddir = /smokeping/smokeping-2.3.6/var
cgiurl = http://some.url/smokeping.cgi
cgiurl = http://IP/htdocs/smokeping.cgi
smokemail = /home/oetiker/checkouts/smokeping/trunk/software/etc/smokemail.dist
smokemail = /smokeping/smokeping-2.3.6/etc/smokemail
tmail = /home/oetiker/checkouts/smokeping/trunk/software/etc/tmail.dist
tmail = /smokeping /smokeping-2.3.6 /etc/tmail.dist
cglib封装了asm,可以在运行期动态生成新的class。cglib用于AOP,jdk中的proxy必须基于接口,cglib却没有这个限制。cglib项目主页 | http://cglib.sourceforge.net/
------------------------------------------------------------------------------------------------------------------------------------
【fping-2.4b2_to】
# wget http://fping.sourceforge.net/download/fping.tar.gz
# tar zxvf fping.tar.gz
# cd fping-2.4b2_to
# ./configure
# make
# make check
# make install
# whereis fping
fping: /usr/local/sbin/fping
------------------------------------------------------------------------------------------------------------------------------------
【echoping】
# wget http://jaist.dl.sourceforge.net/project/echoping/echoping/6.0.0/echoping-6.0.0.tar.gz
# tar zxvf echoping-6.0.0.tar.gz
# cd echoping-6.0.0
# ./configure
# make
# make test
遇到测试不成功等信息就 ctrl+c 回到命令行;
# make install
# whereis echoping
echoping: /usr/local/bin/echoping /usr/local/lib/echoping
------------------------------------------------------------------------------------------------------------------------------------
【CGI-SpeedyCGI-2.22】
# 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
Optional mod_speedycgi support.
Mod_speedycgi increases performance under Apache by avoiding the fork/exec
overhead associated with each request under normal SpeedyCGI. However, it
requires a working copy of "apxs" in your path, Apache with mod_so
support, and additional Apache configuration.
Compile mod_speedycgi (default no)? n
遇到问题选择默认选项( no)
# ls /etc/httpd/modules/
libphp5.so mod_cgid.so mod_include.so mod_proxy.so
……
mod_cern_meta.so mod_imap.so mod_proxy_http.so
这个目录下没有 mod_speedycgi.so,现在需要去下载安装 mod_speedycgi.so
搜到了一个源
# wget ftp://195.220.108.108/linux/epel/5/i386/mod_speedycgi-2.22-4.el5.i386.rpm
# rpm -ivh mod_speedycgi-2.22-4.el5.i386.rpm
warning: mod_speedycgi-2.22-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
error: Failed dependencies:
perl-CGI-SpeedyCGI = 2.22-4.el5 is needed by mod_speedycgi-2.22-4.el5.i386
# wget ftp://fr.rpmfind.net/linux/EPEL/5Server/i386/perl-CGI-SpeedyCGI-2.22-4.el5.i386.rpm
# rpm -ivh --force perl-CGI-SpeedyCGI-2.22-4.el5.i386.rpm
# rpm -ivh mod_speedycgi-2.22-4.el5.i386.rpm
# perl Makefile.PL
# make
# make test
# make install
完成后执行 cd ..退回安装包的目录
===================================================================================
三、配置 【smokeping】
① 下载、解压文件
# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.3.6.tar.gz
# tar zxvf smokeping-2.3.6.tar.gz
# mv smokeping-2.3.6 / smokeping
# cd / smokeping /smokeping-2.3.6
------------------------------------------------------------------------------------------------------------------------------------
② 生成文件
bin/ 下的 smokeping.dist
# cp smokeping.dist smokeping
etc/ 下的 basepage.html.dist,config.dist,smokemail.dist
# cp basepage.html.dist basepage.html
# cp config.dist config
# cp smokemail.dist smokemail
# chmod 600 smokeping_secrets.dist
htdocs/smokeping.cgi.dist
# cp smokeping.cgi.dist smokeping.cgi
/etc/ 下的 config-echoping.dist 可以先不去掉.dist;
------------------------------------------------------------------------------------------------------------------------------------
③ 按下面的步骤改参数:
配置 bin/smokeping
# vi /smokeping/smokeping-2.3.6/bin/ smokeping
主程序,运行在后台。
在这个文件里面我们需要修改前面两个 lib 和后面 config 文件的 path。
两个 lib 分别是 smokeping 的 lib 和 rrdtool 的 lib 。
我的 smokeping 安装在 /usr/local/ 目录中,所以我的设置是:
将以下几行替换为已经安装的相关软件的路径(将 橙×××改为 浅×××):
#!/usr/sepp/bin/perl-5.8.4 -w
#!/usr/bin/perl -w
use lib qw(/usr/pack/rrdtool-1.2.23-mo/lib/perl);
use lib qw( /usr/local/rrdtool-1.3.6/lib/perl );
use lib qw(lib);
use lib qw(/smokeping/smokeping-2.3.6/lib);
use Smokeping 2.003006;
Smokeping::main("etc/config.dist");
Smokeping::main("/smokeping/smokeping-2.3.6/etc/config");
配置 htdocs/smokeping.cgi
# vi /smokeping /smokeping-2.3.6/htdocs/smokeping.cgi
这个文件显示页面、图像和作为 slave 传输数据的接口,设置方法与"bin/smokeping"类似。
但是第一行的 speedy 的路径可能需要修改,否则浏览器中只会看到一个白色的页面。
将以下几行替换为已经安装的相关软件的路径(将 橙×××改为 浅×××):
#!/usr/sepp/bin/speedy -w
# -*-perl-*-
#!/usr/bin/speedy -w
# -*-perl-*-
# use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
use lib qw(/usr/local/rrdtool-1.3.6/lib/perl/);
# use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
use lib qw( / smokeping /smokeping-2.3.6/ lib);
use Smokeping 2.003006;
Smokeping::cgi("/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config");
Smokeping::cgi("/ smokeping /smokeping-2.3.6/etc/config");
配置 htdocs/cropper/*
用来作页面图像放大缩小的工具。
配置 etc/basepage.html
显示页面的主框架。里面之需要配置"htdocs/cropper/"的位置即可。
配置 etc/config
# vi /smokeping/smokeping-2.3.6/etc/config
(config 默认是只读的,需要修改属性)
将以下几行替换为已经安装的相关软件的路径(将 橙×××改为 浅×××):
*** General ***
owner = Peter Random
owner = qu6zhi.test (输入您的名字,显示在网页上)
contact = [email protected]
contact = user@domain (输入您的邮件,显示在网页上)
imgcache = /home/oetiker/public_html/smokeping-ms/cache
imgcache = /smokeping/smokeping-2.3.6/htdocs/cache
imgurl = cache
imgurl = cache
datadir = /tmp/smokeping-ms/data
datadir = /smokeping/smokeping-2.3.6/var
piddir = /tmp/smokeping-ms/var
piddir = /smokeping/smokeping-2.3.6/var
cgiurl = http://some.url/smokeping.cgi
cgiurl = http://IP/htdocs/smokeping.cgi
smokemail = /home/oetiker/checkouts/smokeping/trunk/software/etc/smokemail.dist
smokemail = /smokeping/smokeping-2.3.6/etc/smokemail
tmail = /home/oetiker/checkouts/smokeping/trunk/software/etc/tmail.dist
tmail = /smokeping /smokeping-2.3.6 /etc/tmail.dist
*** Presentation ***
template = /home/oetiker/checkouts/smokeping/trunk/software/etc/basepage.html.dist
template = /smokeping/smokeping-2.3.6/etc/basepage.html
*** Database ***
step = 30 // web 页面的刷新时间 这里要修改,不然30秒发出1000个包,远端的机器还以为是******;修改为100秒 发出20个包 ;
pings = 1000
pings = 1000
*** Alerts ***
to = [email protected]
to = user@domain (要收到报警邮件的 e-mail address)
from = [email protected]
from = smokealert@localhost (本机要发送的账号)
*** Targets ***
编辑要做监控的主机
编辑方式采阶层式, 用 + (加号) 做阶层功能
probe = FPing
normal 是100bit
default 是 1024bit
+ Test
menu = Top
title = Network Latency Grapher(描述)
++ stddev(++ 第二层分类)
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation(menu = 第二层)
format = Standard Deviation %f
title = 第二层的描述
+++ Switch001
menu = 第三层里的配置 (可以继续分层)
title = 第三层里的设备的名称
host = 192.168.1.254 (IP 或 domain name 都可以)
+++ Switch002
menu = 第三层里的设备 (可以继续分层)
title = 第三层里的设备的名称
host = 192.168.2.254 (IP 或 domain name 都可以)
menu = Multihost
title = James and James as seen from Boomer
host = /World/第二层分类/Switch001 /World/第二层分类/Switch002 (将多个图合并到一个图中)
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to this SmokePing website.
+ mysite1
menu = Site 1
title = Hosts in Site 1
++ myhost1
host = myhost1.mysite1.example
++ myhost2
host = myhost2.mysite1.example
+ mysite2
menu = Site 2
title = Hosts in Site 2
++ myhost3
host = myhost3.mysite2.example
++ myhost4
host = myhost4.mysite2.example
注意:设备名字当中不能出现“.”。
*** Probes ***
+ FPing
binary = /usr/sbin/fping
binary = /smokeping/fping-2.4b2_to/fping
*** Slaves ***
secrets=/smokeping/smokeping-2.3.6/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#+slave2
显示中文
*** Presentation ***
中,加入:
charset = gb2312
不过 rrdtool 图像中还是显示不了中文。
最后:
# mkdir /smokeping/smokeping-2.3.6/htdocs/cache
# mkdir /smokeping/smokeping-2.3.6/var
*** Probes ***
+ FPing
binary = /usr/sbin/fping
binary = /smokeping/fping-2.4b2_to/fping
*** Slaves ***
secrets=/smokeping/smokeping-2.3.6/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#+slave2
显示中文
*** Presentation ***
中,加入:
charset = gb2312
不过 rrdtool 图像中还是显示不了中文。
最后:
# mkdir /smokeping/smokeping-2.3.6/htdocs/cache
# mkdir /smokeping/smokeping-2.3.6/var
===================================================================================
#
vi /smokeping/smokeping-2.3.6/etc/config
确认下图的配置
imgcache = /home/oetiker/public_html/smokeping-ms/cache
imgcache = /smokeping/smokeping-2.3.6/htdocs/cache
imgurl = cache
imgurl = cache
datadir = /tmp/smokeping-ms/data
datadir = /smokeping/smokeping-2.3.6/var
piddir = /tmp/smokeping-ms/var
piddir = /smokeping/smokeping-2.3.6/var
imgcache = /smokeping/smokeping-2.3.6/htdocs/cache
imgurl = cache
imgurl = cache
datadir = /tmp/smokeping-ms/data
datadir = /smokeping/smokeping-2.3.6/var
piddir = /tmp/smokeping-ms/var
piddir = /smokeping/smokeping-2.3.6/var
查看缓存 /smokeping/smokeping-2.3.6/htdocs/cache/HP-IDC/ 没有发现 png 文件,这样不正常。
给 smokeping 目录
apache 完全权限,不然 rrdtool 会画不出图:
# chown -R apache:apache /smokeping/smokeping-2.3.6/
# chown -R apache:apache /smokeping/smokeping-2.3.6/
- imgurl (mandatory setting)
-
Either an absolute URL to the imgcache directory or one relative to the directory where you keep the SmokePing cgi.
- # vi /smokeping/smokeping-2.3.6/etc/config
-
……
- #imgurl = /smokeping/smokeping-2.3.6/htdocs/cache
-
imgurl = cache
……
===================================================================================
四、web 页面认证的配置
# wget http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/authors/id/H/HO/HORROCKS/CGI-SpeedyCGI-1.8.2.tar.gz
① 把运营设备 /var/www/.htaccess 拷贝到新设备的 /var/www 目录下;
② 把运营设备 /smokeping/smokeping-2.3.6/etc/htpasswd.users 拷贝到新设备的 /smokeping/smokeping-2.3.6/etc 目录下;如果考不过来,就在运营设备上 vi htpasswd.users ,同时在新设备上 vi /smokeping/smokeping-2.3.6/etc/htpasswd.users ,然后把运营设备的那个文件里面的内容拷贝到新设备的那个文件里,(noc:bC6fBME.DZLHE)保存推出vi ;
③ 接下来配置 smokeping 的储存图形文件的目录,不然会画不出图:
# mkdir /smokeping/smokeping-2.3.6/.simg
# chown -R apache:apache /smokeping/smokeping-2.3.6/
④ 接下来编辑 apache 的配置文件,让apache能执行 smokeping 的 html 文件:
# vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
DocumentRoot /smokeping/smokeping-2.3.6/htdocs
ServerName dummy-host.example.com
ScriptAlias /index.html /smokeping/smokeping-2.3.6/htdocs/smokeping.cgi
把下面这段加到下面几行配置下面
Options FollowSymLinks
AllowOverride None
要加的配置是:
"/smokeping/smokeping-2.3.6/htdocs">
Options FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
/smokeping/smokeping-2.3.6>
Options FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
Allow from all
⑤ 然后,为了不让 apache 找 mysql 去认证,需要:
# yum install mod_auth_mysql
===================================================================================
六、运行环境
删除进程:
# cd /smokeping/smokeping-2.3.6/etc
# killall smokeping(多执行)
# ps -efH |grep smokeping
启动进程:
# /smokeping/smokeping-2.3.6/bin/smokeping start
# service httpd restart
四、web 页面认证的配置
# wget http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/authors/id/H/HO/HORROCKS/CGI-SpeedyCGI-1.8.2.tar.gz
① 把运营设备 /var/www/.htaccess 拷贝到新设备的 /var/www 目录下;
② 把运营设备 /smokeping/smokeping-2.3.6/etc/htpasswd.users 拷贝到新设备的 /smokeping/smokeping-2.3.6/etc 目录下;如果考不过来,就在运营设备上 vi htpasswd.users ,同时在新设备上 vi /smokeping/smokeping-2.3.6/etc/htpasswd.users ,然后把运营设备的那个文件里面的内容拷贝到新设备的那个文件里,(noc:bC6fBME.DZLHE)保存推出vi ;
③ 接下来配置 smokeping 的储存图形文件的目录,不然会画不出图:
# mkdir /smokeping/smokeping-2.3.6/.simg
# chown -R apache:apache /smokeping/smokeping-2.3.6/
④ 接下来编辑 apache 的配置文件,让apache能执行 smokeping 的 html 文件:
# vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
DocumentRoot /smokeping/smokeping-2.3.6/htdocs
ServerName dummy-host.example.com
ScriptAlias /index.html /smokeping/smokeping-2.3.6/htdocs/smokeping.cgi
把下面这段加到下面几行配置下面
Options FollowSymLinks
AllowOverride None
要加的配置是:
Options FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
Options FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
Allow from all
⑤ 然后,为了不让 apache 找 mysql 去认证,需要:
# yum install mod_auth_mysql
===================================================================================
六、运行环境
删除进程:
# cd /smokeping/smokeping-2.3.6/etc
# killall smokeping(多执行)
# ps -efH |grep smokeping
启动进程:
# /smokeping/smokeping-2.3.6/bin/smokeping start
# service httpd restart
配置开机自动运行
#
vi /etc/rc.d/rc.local
/smokeping/smokeping-2.3.6/bin/smokeping start
打开浏览器,
http://x.x.x.x/htdocs/smokeping.cgi
===================================================================================
七、访问权限
①
修改 httpd.conf
#
vi /etc/httpd/conf/httpd.conf
306
307
308 #
309 # Possible values for the Options directive are "None", "All",
310 # or any combination of:
311 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
312 #
313 # Note that "MultiViews" must be named *explicitly* --- "Options All"
314 # doesn't give it to you.
315 #
316 # The Options directive is both complicated and important. Please see
317 # http://httpd.apache.org/docs/2.2/mod/core.html#options
318 # for more information.
319 #
320
Options Indexes FollowSymLinks
321
322 #
323 # AllowOverride controls what directives may be placed in .htaccess files.
324 # It can be "All", "None", or any combination of the keywords:
325 # Options FileInfo AuthConfig Limit
326 #
327
AllowOverride AuthConfig
328
329 #
330 # Controls who can get stuff from this server.
331 #
332
Order allow,deny
333
Allow from all
334
335
意思是在
/smokeping/smokeping-2.3.6/htdocs 下不同目录的访问权限由该目录下的
.htaccess 文件来控制,而且不同目录的权限策略可互相覆盖。
②
编辑 .htaccess 文件
# vi /smokeping/smokeping-2.3.6/htdocs/ .htaccess.smoke #访问权限控制文件
AuthUserFile /smokeping/smokeping-2.3.6/htdocs/htpasswd.smoke.user # 用户密码信息存放文件
AuthType Basic #认证类型为基本型
AuthName "smokeping" #弹出对话框的说明
require valid-user #认证方式
保存退出。
③ 建立用户
# /usr/bin/htpasswd –c /smokeping/smokeping-2.3.6/htdocs/htpasswd.smoke.user admin # 建立用户 admin
New password: # 输入用户密码
Re-type new password: # 再次输入密码
Adding password for user admin # 添加用户成功信息
可以建立多个用户
# vi /smokeping/smokeping-2.3.6/htdocs/ .htaccess.smoke #访问权限控制文件
AuthUserFile /smokeping/smokeping-2.3.6/htdocs/htpasswd.smoke.user # 用户密码信息存放文件
AuthType Basic #认证类型为基本型
AuthName "smokeping" #弹出对话框的说明
require valid-user #认证方式
保存退出。
③ 建立用户
# /usr/bin/htpasswd –c /smokeping/smokeping-2.3.6/htdocs/htpasswd.smoke.user admin # 建立用户 admin
New password: # 输入用户密码
Re-type new password: # 再次输入密码
Adding password for user admin # 添加用户成功信息
可以建立多个用户
④ # chgrp apache htpasswd.smoke.user
# chmod 640 htpasswd.smoke.user
⑤
重启 apache,再次访问http://xxx.xxx.xxx.xxx,这时应该出现一个身份认证窗口,你需要输入用户名和密码才能访问这个页面。
如果你也遇到 Apache 还不支持 .htaccess 的情况,使用我上面的这个情况不行的话,那就在 httpd.conf 文件里搜索
LoadModule rewrite_module modules/mod_rewrite.so,如果前面有 # 符号,就去掉。保存,然后重启 Apache 。
===================================================================================
285 vi /etc/bashrc
286 w
320 netstat -anptu
321 ps -A | grep smoke
===================================================================================
参考:
285 vi /etc/bashrc
286 w
320 netstat -anptu
321 ps -A | grep smoke
===================================================================================
参考:
官方:http://oss.oetiker.ch/smokeping/
官方:http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html
https://confluence.slac.stanford.edu/display/IEPM/Smokeping+Installation
http://blog.sina.com.cn/s/blog_58d6275e01000a5s.html
http://hi.baidu.com/qu6zhi/blog/item/e80633dc3e8926a8cd1166ab.html
http://www.blogjava.net/ruoyoux/articles/257138.html
http://linux.chinaunix.net/bbs/thread-1064864-1-1.html
http://bbs.wglm.net/read.php?tid=98204&uid=12891
http://search.cpan.org/~horrocks/CGI-SpeedyCGI-2.22/
http://search.cpan.org/~horrocks/CGI-SpeedyCGI-2.22/lib/CGI/SpeedyCGI.pm
http://daemoninc.com/SpeedyCGI/
http://search.cpan.org/~horrocks/CGI-SpeedyCGI-2.22/src/SpeedyCGI.src
http://pzc.nio.name/?p=282
http://www.boy110.com/apache-htaccess/
http://blog.sina.com.cn/s/blog_5398c3200100b4in.html~type=v5_one&label=rela_nextarticle
http://www.fastmirrors.org/smokeping/probe/TelnetJunOSPing.en.html
http://hi.baidu.com/qu6zhi/blog/item/41eae42e3f455e594fc226a7.html
http://blogs.techrepublic.com.com/networking/?p=334
Install Smokeping on openBSD:http://idur.staff.uns.ac.id/tag/smokeping/page/2/
http://blog.sina.com.cn/s/blog_6151984a0100euux.html###
http://www.mw.net.tw/user/lindahu/blog/2005/04/26/1502/5188/
http://www.mw.net.tw/user/lindahu/blog/2005/12/20/1502/18268/
http://bbs.chinaunix.net/viewthread.php?tid=678582&page=1
================================================
官方:http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html
https://confluence.slac.stanford.edu/display/IEPM/Smokeping+Installation
http://blog.sina.com.cn/s/blog_58d6275e01000a5s.html
http://hi.baidu.com/qu6zhi/blog/item/e80633dc3e8926a8cd1166ab.html
http://www.blogjava.net/ruoyoux/articles/257138.html
http://linux.chinaunix.net/bbs/thread-1064864-1-1.html
http://bbs.wglm.net/read.php?tid=98204&uid=12891
http://search.cpan.org/~horrocks/CGI-SpeedyCGI-2.22/
http://search.cpan.org/~horrocks/CGI-SpeedyCGI-2.22/lib/CGI/SpeedyCGI.pm
http://daemoninc.com/SpeedyCGI/
http://search.cpan.org/~horrocks/CGI-SpeedyCGI-2.22/src/SpeedyCGI.src
http://pzc.nio.name/?p=282
http://www.boy110.com/apache-htaccess/
http://blog.sina.com.cn/s/blog_5398c3200100b4in.html~type=v5_one&label=rela_nextarticle
http://www.fastmirrors.org/smokeping/probe/TelnetJunOSPing.en.html
http://hi.baidu.com/qu6zhi/blog/item/41eae42e3f455e594fc226a7.html
http://blogs.techrepublic.com.com/networking/?p=334
Install Smokeping on openBSD:http://idur.staff.uns.ac.id/tag/smokeping/page/2/
http://blog.sina.com.cn/s/blog_6151984a0100euux.html###
http://www.mw.net.tw/user/lindahu/blog/2005/04/26/1502/5188/
http://www.mw.net.tw/user/lindahu/blog/2005/12/20/1502/18268/
http://bbs.chinaunix.net/viewthread.php?tid=678582&page=1
================================================
在我配置smokeping 的过程中参考了上篇文章,配置过程中有些路径是上下是不对的,在配置的过程不要照抄,要仔细的看一下;总之是一篇不错的文章;
下面是我的配置apache的http.conf文件
ScriptAlias /smokeping.cgi "/usr/local/smokeping/htdocs/smokeping.cgi"
Alias /cache "/usr/local/smokeping/htdocs/cache"
AllowOverride None
AddHandler cgi-script cgi
Options ExecCGI
Alias /cache "/usr/local/smokeping/htdocs/cache"
AllowOverride None
AddHandler cgi-script cgi
Options ExecCGI
附上smokeping 配置文件
*** General ***
owner = noc
contact = [email protected]
mailhost = my.mail.host
sendmail = /usr/lib/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/cache
#imgurl = http://192.168.250.107/cache
imgurl = cache
datadir = /usr/local/smokeping/var
piddir = /usr/local/smokeping/var
cgiurl = http://192.168.250.107/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail
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 = [email protected]
from = smokealert@localhost
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 100
pings = 20
# consfn mrhb steps total
AVERAGE 0.5 1 1008
AVERAGE 0.5 12 4320
MIN 0.5 12 4320
*** Presentation ***
template = /usr/local/smokeping/etc/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
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
#++ location
#title = Location
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
*** Slaves ***
secrets= /usr/local/smokeping/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.
+ JIETONG
menu = JIETONG
title = JIETONG
++ 111server
menu = 111server
title = 111server
host = 192.168.250.111
++ 107server
menu = 107server
title =107server
host = 192.168.250.107
++ 217server
menu = 217server
title =217server
host = 217.19.149.132
owner = noc
contact = [email protected]
mailhost = my.mail.host
sendmail = /usr/lib/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/cache
#imgurl = http://192.168.250.107/cache
imgurl = cache
datadir = /usr/local/smokeping/var
piddir = /usr/local/smokeping/var
cgiurl = http://192.168.250.107/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail
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 = [email protected]
from = smokealert@localhost
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 100
pings = 20
# consfn mrhb steps total
AVERAGE 0.5 1 1008
AVERAGE 0.5 12 4320
MIN 0.5 12 4320
*** Presentation ***
template = /usr/local/smokeping/etc/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
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
#++ location
#title = Location
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
*** Slaves ***
secrets= /usr/local/smokeping/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.
+ JIETONG
menu = JIETONG
title = JIETONG
++ 111server
menu = 111server
title = 111server
host = 192.168.250.111
++ 107server
menu = 107server
title =107server
host = 192.168.250.107
++ 217server
menu = 217server
title =217server
host = 217.19.149.132
后来用tar包方式安装lamp结构,如果在安装上面配置apache时 会出现提示
“
You don’t have permission to access / on this server”
打开Apache的配置文件httpd.conf ,查找下面这段:
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
修改为
Options Indexes FollowSymLinks
AllowOverride None
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
修改为
Options Indexes FollowSymLinks
AllowOverride None
重启Apache。