Smokeping 网络监控开源软件

Smokeping 安装配置
一、介绍
smokepingrrdtool的作者Tobi Oetiker的作品,所以它在图形显示方面有很大优势,也是一个很有特点的opensource工具:多种探测方式,包括fping、echoping、dig、curl等;
易用可扩展的插件;
master/slave的工作方式,可以在多个节点收集同一个监测点的数据;很有特色的alert设置,不只是简单的设置一个阀值;

二、安装

在装好LAMP与PERL基础上,再安装以下软件

所需软件

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

wget http://www.bjlx.org.cn/debian/pool/main/e/echoping/echoping_5.2.0.orig.tar.gz

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

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

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

安装fping-2.4-1.b2.2.el5.rf.x86_64.rpm

Rpm ?ivh fping-2.4-1.b2.2.el5.rf.x86_64.rpm

安装CGI-SpeedyCGI-2.22.tar.gz

Tar ?zxvf CGI-SpeedyCGI-2.22.tar.gz

cd CGI-SpeedyCGI-2.22

perl Makefile.PL

Compile mod_speedycgi (default no)? no

Make && make install

安装echoping_5.2.0.orig.tar.gz

Tar zxvf echoping_5.2.0.orig.tar.gz

cd echoping_5.2.0

./configure --prefix=/usr/local/echoping --with-ssl --without-libidn

Make && make install

安装rrdtool-1.4.2.tar.gz

Tar zxvf rrdtool-1.4.2.tar.gz

Cd rrdtool-1.4.2

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

Make && make install

安装:smokeping-2.4.2.tar.gz

Tar zxvf smokeping-2.4.2.tar.gz

mv smokeping-2.4.2 /usr/local/smokeping

二、修改相关配置文件

Mkdir ?p /usr/local/smokeping/cache

Mkdir ?p /usr/local/smokeping/var

1、/usr/local/smokeping/etc/ config.dist
如下:

  1. *** General ***

  2. owner = apache 
  3. contact = tomlinx@linuxtone.org 
  4. mailhost = localhost
  5. sendmail = /usr/local/bin/sendmail
  6. # NOTE: do not put the Image Cache below cgi-bin
  7. # since all files under cgi-bin will be executed ... this is not
  8. # good for images.
  9. imgcache = /usr/local/smokeping/cache
  10. imgurl = ../cache 不要用绝对路径
  11. datadir = /usr/local/smokeping/var
  12. piddir = /usr/local/smokeping/var
  13. cgiurl = http://some.url/smokeping.cgi
  14. smokemail = /usr/local/smokeping/etc/smokemail.dist
  15. tmail = /usr/local/smokeping/etc/tmail.dist
  16. # specify this to get syslog logging
  17. syslogfacility = local0
  18. # each probe is now run in its own process
  19. # disable this to revert to the old behaviour
  20. # concurrentprobes = no

  21. *** Alerts ***
  22. #to = |/usr/local/smokeping/fx.sh
  23. to = tomlinux@linuxtone.org
  24. from = abc@xy.com 
  25. 定义丢包率;
  26. +someloss
  27. type = loss
  28. # in percent
  29. pattern = >0%,*12*,>0%,*12*,>0%
  30. comment = loss 3 times in a row
  31. (检测12次,出现了3次丢包的情况,不论丢多少个包,就进行alter)
  32. +rttbad
  33. type = rtt
  34. pattern = ==S,>50,>50
  35. comment = route
  36. (如果连续出现两次50ms 以上的延时,就进行alter)
  37. *** Database ***
  38. (每300秒ping 20次)

  39. step = 300
  40. pings = 20

  41. # consfn mrhb steps total

  42. AVERAGE 0.5 1 1008
  43. AVERAGE 0.5 12 4320
  44. MIN 0.5 12 4320
  45. MAX 0.5 12 4320
  46. AVERAGE 0.5 144 720
  47. MAX 0.5 144 720
  48. MIN 0.5 144 720

  49. *** Presentation ***

  50. template = /usr/local/smokeping/etc/basepage.html.dist (定义页面模板)

  51. + charts

  52. menu = Charts
  53. title = The most interesting destinations

  54. ++ stddev
  55. sorter = StdDev(entries=>4)
  56. title = Top Standard Deviation
  57. menu = Std Deviation
  58. format = Standard Deviation %f

  59. ++ max
  60. sorter = Max(entries=>5)
  61. title = Top Max Roundtrip Time
  62. menu = by Max
  63. format = Max Roundtrip Time %f seconds

  64. ++ loss
  65. sorter = Loss(entries=>5)
  66. title = Top Packet Loss
  67. menu = Loss
  68. format = Packets Lost %f

  69. ++ median
  70. sorter = Median(entries=>5)
  71. title = Top Median Roundtrip Time
  72. menu = by Median
  73. format = Median RTT %f seconds

  74. + overview 定义流量图大小

  75. width = 600
  76. height = 50
  77. range = 10h

  78. + detail

  79. width = 600
  80. height = 200
  81. unison_tolerance = 2

  82. "Last 3 Hours" 3h
  83. "Last 30 Hours" 30h
  84. "Last 10 Days" 10d
  85. "Last 400 Days" 400d

  86. #+ hierarchies
  87. #++ owner
  88. #title = Host Owner
  89. #++ location
  90. #title = Location

  91. *** Probes ***

  92. + FPing

  93. binary = /usr/sbin/fping PING使用的工具

  94. #*** Slaves ***
  95. #secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
  96. #+boomer
  97. #display_name=boomer
  98. #color=0000ff

  99. #+slave2
  100. #display_name=another
  101. #color=00ff00

  102. *** Targets ***

  103. probe = FPing

  104. menu = Top
  105. title = Network Latency Grapher
  106. remark = Welcome to the SmokePing website of xxx Company. \
  107. Here you will learn all about the latency of our network.

  108. + Test 定义一级目录
  109. menu= test
  110. tile = test
  111. #parents = owner:/Test/James location:/

  112. ++ host1 添加主机
  113. title = host1
  114. alerts = someloss,rttbad
  115. host = 192.168.11.111

  116. + nagios
  117. menu = nagios
  118. ++ nagios
  119. title = nagios
  120. alerts = someloss
  121. host = 192.168.11.105
复制代码

2、/usr/local/smokeping/htdocs/smokeping.cgi修改

Cp /usr/local/smokeping/htdocs/smokeping.cgi.dist usr/local/smokeping/htdocs/smokeping.cgi

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 修改

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

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

4、启动/usr/local/smokeping/bin/smokeping.dist start

Chown apache.apache /usr/local/smokeping ?R

三、配置httpd.conf

如下:

Alias /smokeping/ "/usr/local/smokeping/"

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


AllowOverride None


AddHandler cgi-script cgi


Options ExecCGI


Order allow,deny


Allow from all

</Directory>

启动脚本:http://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script

访问:http://ip/smokeping/htdocs/smokeping.cgi

参考:

http://www.joecen.com/2008/10/09/use-smokeping/

http://hi.baidu.com/powerdj/blog/item/553659dfc9ea371b48540366.html

posted on 2012-04-21 17:03  草原和大树  阅读(1434)  评论(0编辑  收藏  举报