设为首页 收藏本站
查看: 1734|回复: 0

[经验分享] smokeping部署安装

[复制链接]

尚未签到

发表于 2015-9-9 08:13:26 | 显示全部楼层 |阅读模式
  smokeping部署安装
  
  部署情况:
  
  服务器IP:192.168.10.18
  
  smokeping部署在/var/www/html/smokeping目录
  
  smokeping部分命令:
  smokeping --check
  Smokeping --debug
  smokeping --logfile=/var/log/smokeping.log
  
  安装支持软件:
  首先需要安装epel软件包,再进行yum
  yum install gcc freetype-devel zlib-devel libpng-devel libart_lgpl-devel httpd-devel apr-util-devel apr-devel cairo cairo-devel pango pango-devel libxml2 libxml2-devel perl-XML-Simple.noarch perl-Crypt-SSLeay perl-Digest-HMAC

  安装rrdtool
  [iyunv@smokeping smokeping]# tar -zxvf rrdtool-1.4.4.tar.gz -C /usr/local/
  [iyunv@smokeping smokeping]# cd /usr/local/rrdtool-1.4.4/
  [iyunv@smokeping rrdtool-1.4.4]# ./configure --prefix=/usr/local/rrdtool
  [iyunv@smokeping rrdtool-1.4.4]# make && make install
  并将rrdtool路径加入环境变量
vi /etc/profile
  export PKG_CONFIG_PATH=/usr/local/rrdtool/lib/pkgconfig
  export PKG_CONFIG=/usr/local/rrdtool/bin/pkg-config
  export PATH=/usr/local/rrdtool/bin:$PATH
  
  安装Fping和Echoping,此处安装之后,配置环境变量即可,不需要严格按照路径安装
  [iyunv@smokeping bin]# cd /root/smokeping/
  [iyunv@smokeping smokeping]# tar -zxvf fping.tar.gz -C /usr/local/
  [iyunv@smokeping smokeping]# cd /usr/local/fping-2.4b2_to/
  [iyunv@smokeping fping-2.4b2_to]# ./configure
  [iyunv@smokeping fping-2.4b2_to]# make && make install
  [iyunv@smokeping fping-2.4b2_to]# ln -s /usr/local/fping/sbin/fping /usr/sbin/fping
  [iyunv@smokeping fping-2.4b2_to]#cd /root/smokeping/
  [iyunv@smokeping smokeping]#tar -zxvf echoping-6.0.2.tar.gz -C /usr/local/
  [iyunv@smokeping smokeping]#cd /usr/local/echoping-6.0.2
  [iyunv@smokeping echoping-6.0.2]# ./configure
  [iyunv@smokeping echoping-6.0.2]# make && make install
  2.4 安装cgilib和SpeedyCGI
  [iyunv@smokeping echoping-6.0.2]# cd /root/smokeping/
  [iyunv@smokeping smokeping]# tar -zxvf cgilib-0.5.tar.gz -C /usr/local/
  [iyunv@smokeping smokeping]# cd /usr/local/cgilib-0.5/
  [iyunv@smokeping cgilib-0.5]# ls
  cgi.5           cgiGetCookies.3    cgiRedirect.3   cookies.txt
  cgi.c           cgiGetValue.3      cgiSetHeader.3  CREDITS
  cgiDebug.3      cgiGetVariables.3  cgiSetType.3    jumpto.c
  cgiFree.3       cgi.h              cgitest.c       Makefile
  cgiFreeList.3   cgiHeader.3        CHANGES         readme
  cgiGetCookie.3  cgiInit.3          cookies.c
  [iyunv@smokeping cgilib-0.5]#
  [iyunv@smokeping cgilib-0.5]# make
  [iyunv@smokeping cgilib-0.5]# cp libcgi.a /usr/local/lib
  [iyunv@smokeping cgilib-0.5]# cp cgi.h /usr/include/
  [iyunv@smokeping cgilib-0.5]# cd /root/smokeping/
  [iyunv@smokeping smokeping]# tar -zxvf CGI-SpeedyCGI-2.22.tar.gz -C /usr/local/
  [iyunv@smokeping smokeping]# cd /usr/local/CGI-SpeedyCGI-2.22/
  [iyunv@smokeping CGI-SpeedyCGI-2.22]# ls
  COPYING   Makefile.PL  contrib  mod_speedycgi   speedy_backend  util
  Changes   README       docs     mod_speedycgi2  speedy_dump
  MANIFEST  README.html  lib      speedy          src
  [iyunv@smokeping CGI-SpeedyCGI-2.22]# perl Makefile.PL
  [iyunv@smokeping CGI-SpeedyCGI-2.22]# make
  [iyunv@smokeping CGI-SpeedyCGI-2.22]# make install
  
  安装Perl模块
  以下全是Smokeping 需要的perl 模块。
  [iyunv@smokeping ~]# yum install -y perl-libwww-perl perl-IO-Socket-SSL perl-Net-Telnet perl-Socket6 perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL
  安装Smokeping
  wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.3.6.tar.gz
  tar xzvf smokeping-2.3.6.tar.gz
  cp -rp smokeping-2.3.6 /var/www/html/smokeping
  
  三. Smokeping 初始化配置
  3.1修改smokeping相关文件名
  在smokeping的子目录中会发现很多“*.dist”命名的文件,这些文件使用的时候请将其改名为“*”并进行配置
  
  cd /var/www/html/smokeping/bin/
  cp smokeping.dist smokeping
  cd ../htdocs/
  cp smokeping.cgi.dist smokeping.cgi
  cd ../etc/
  cp basepage.html.dist basepage.html
  cp config.dist config
  cp smokemail.dist smokemail
  chmod 600 smokeping_secrets.dist
  
  
  3.2建立相关目录
  接着建立三个目录用于保存smokeping的数据等,如下所示:
  [iyunv@smokeping ~]# mkdir
  smokeping/data
  [iyunv@smokeping ~]# mkdir /var/www/html/smokeping/var
  [iyunv@smokeping ~]# mkdir /var/www/html/smokeping/cache
  [iyunv@smokeping ~]# yum install -y httpd
  [iyunv@smokeping ~]# chown -R apache.apache /var/www/html/smokeping
  
  
  修改配置文件
  形如:其中,标红部分需要根据实际路径和情况修改。
  1./var/www/html/smokeping/etc/config文件
  [iyunv@cdn18 etc]# more config
  *** General ***
  
  owner    = Peter Random
  contact  = some@address.nowhere
  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 images.
  imgcache = /var/www/html/smokeping/htdocs/cache
  #imgcache = /home/oetiker/public_html/smokeping-ms/cache
  imgurl   = http://192.168.10.18:8080/smokeping/cache
  #imgurl   = cache
  datadir  = /var/www/html/smokeping/data
  #datadir  = /tmp/smokeping-ms/data
  piddir  = /var/www/html/smokeping/var
  #piddir  = /tmp/smokeping-ms/var
  cgiurl   = http://192.168.10.18:8080/smokeping/smokeping.cgi
  smokemail = /var/www/html/smokeping/etc/smokemail
  #smokemail = /home/oetiker/checkouts/smokeping/trunk/software/etc/smokemail.dist
  tmail = /var/www/html/smokeping/etc/tmail.dist
  #tmail = /home/oetiker/checkouts/smokeping/trunk/software/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 = alertee@address.somewhere
  from = smokealert@company.xy
  
  +someloss
  type = loss
  # in percent
  pattern = >0%,*12*,>0%,*12*,>0%
  comment = loss 3 times  in a row
  
  *** Database ***
  
  step     = 60
  pings    = 10
  
  # 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 = /var/www/html/smokeping/etc/basepage.html
  #template = /home/oetiker/checkouts/smokeping/trunk/software/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 = 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
  unison_tolerance = 2
  
  "Last 3 Hours"    3h
  "Last 30 Hours"   30h
  "Last 10 Days"    10d
  "Last 400 Days"   400d
  
  #+ hierarchies
  #++ owner
  #title = Host Owner
  #++ location
  #title = Location
  
  *** Probes ***
  
  + FPing
  
  binary = /usr/local/sbin/fping
  sourceaddress = 0.0.0.0
  
  *** Slaves ***
  secrets=/var/www/html/smokeping/etc/smokeping_secrets.dist
  +boomer
  display_name=boomer
  location=dh
  color=0000ff
  +192.168.10.18
  display_name=192.168.10.18
  location=dh
  color=0000ff
  ++override
  Probes.FPing.binary = /usr/local/sbin/fping
  Probes.FPing.sourceaddress = 192.168.10.18
  +slave2
  display_name=another
  color=00ff00
  
  *** 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.
  
  + Test
  menu= Targets
  #parents = owner:/Test/James location:/
  
  ++ James
  
  menu = James
  title =James
  alerts = someloss
  slaves = boomer slave2
  host = 192.168.10.18
  
  ++ MultiHost
  
  menu = Multihost
  title = James and James as seen from Boomer
  host = /Test/James /Test/James~boomer
  
  + DunHuang
  menu = DunHuang
  title = DunHuang
  
  ++ dhyk18
  menu = dhyk18
  title = dhyk18
  host = 192.168.10.18
  
  ++ dhyk19
  menu = dhyk19
  title = dhyk19
  host = 192.168.10.19
  
  修改配置文件
  /var/www/html/smokeping/htdocs/smokeping.cgi,标红部分请按照实际情况修改
  
  #!/usr/bin/speedy -w
  ####!/usr/sepp/bin/speedy -w
  # -*-perl-*-
  
  #use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
  use lib qw(/usr/local/rrdtool/lib/perl/);
  use lib qw(/var/www/html/smokeping/lib);
  #use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
  use CGI::Carp qw(fatalsToBrowser);
  
  use Smokeping 2.003006;
  
  Smokeping::cgi("/var/www/html/smokeping/etc/config");
  #Smokeping::cgi("/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config");
  
  (4)配置apache  /conf/httpd.conf
  Alias /smokeping/ "/var/www/html/smokeping/htdocs/"
  Alias /cache/ "/var/www/html/smokeping/cache/"
  <Directory "/var/www/html/smokeping/htdocs">
          Options FollowSymLinks ExecCGI
          AllowOverride None
          AddHandler cgi-script cgi
          Order allow,deny
          Allow from all
  </Directory>
  
  
  (2)检查smokeping配置文件:
  [iyunv@smokeping ~]# /usr/local/smokeping/bin/smokeping --check
  Configuration file '/usr/local/smokeping/etc/config' syntax OK.
  (3)启动smokeping:(无法启动)
  [iyunv@smokeping ~]# service smokeping start
  ERROR: slave 'boomer' is not defined in the '*** Slaves ***' section!
  /etc/init.d/smokeping start: smokeping could not be started
  
  出现此类问题,是因为没有配置slave之类的,在前面的配置文件中,我已经配置,故不需要考虑。
  
  实际解决方法如下:标红部分按照实际情况修改
  [iyunv@smokeping ~]# vim /var/www/html/smokeping/etc/config
  + FPing
  binary = /usr/local/sbin/fping
  sourceaddress = 0.0.0.0
  *** Slaves ***
  secrets=/var/www/html/smokeping/etc/smokeping_secrets.dist
  +192.168.10.18
  display_name=192.168.10.18
  location=dh
  color=0000ff
  ++override
  Probes.FPing.binary = /usr/local/sbin/fping
  Probes.FPing.sourceaddress = 192.168.10.18
  
  [iyunv@smokeping ~]# service smokeping restart
  ERROR: /usr/local/smokeping/etc/config, line 111: File '/usr/local/smokeping/etc/smokeping_secrets.dist' is world-readable or writable, refusing it
  /etc/init.d/smokeping start: smokeping could not be started
  [iyunv@smokeping src]# ll /usr/local/smokeping/etc/smokeping_secrets.dist
  -rw-r--r-- 1 apache apache 59 Aug 21  2007 /usr/local/smokeping/etc/smokeping_secrets.dist
  [iyunv@smokeping src]# chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist
  [iyunv@smokeping src]# ll /usr/local/smokeping/etc/smokeping_secrets.dist
  -r-------- 1 apache apache 59 Aug 21  2007 /usr/local/smokeping/etc/smokeping_secrets.dist
  [iyunv@smokeping ~]# ./smokeping restart
  WARNING: Hostname 'james.address' does currently not resolve to an IPv6 or IPv4 address
  ERROR: slave 'boomer' is not defined in the '*** Slaves ***' section!
  /etc/init.d/smokeping start: smokeping could not be started
  *** Slaves ***
  secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
  +boomer
  display_name=boomer
  location=dh
  color=00ffff
  +192.168.10.18
  display_name=192.168.10.18
  location=dh
  color=0000ff
  ++override
  Probes.FPing.binary = /usr/local/sbin/fping
  Probes.FPing.sourceaddress = 192.168.10.18
  +slave2
  display_name=another
  color=00ff00
  [iyunv@smokeping ~]# service smokeping restart
  /etc/init.d/smokeping start: smokeping started
  [iyunv@smokeping ~]#
  [iyunv@smokeping ~]# service httpd restart
  Stopping httpd:                                            [  OK  ]
DSC0000.jpg

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-111185-1-1.html 上篇帖子: smokeping安装 下篇帖子: smokeping for centos 5.5 by simple
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表