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

[经验分享] 安装配置smokeping

[复制链接]

尚未签到

发表于 2019-1-17 11:38:17 | 显示全部楼层 |阅读模式
  1、centos安装,省略,我默认大家都会了。呵呵
  2、yum update
  更新一下系统软件
  3、更新一下安装源
  rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  4、安装httpd
  yum install httpd
  5、安装探针
  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-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI
  5、下载安装smokeping
  wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.1.tar.gz
  //下载smokeping软件,我是保存到/root目录下的
  tar zxvf smokeping-2.4.2.tar.gz
  //解压软件包
  mv smokeping-2.4.2 /opt/smokeping
  //把软件包移动到/opt目录下,本软件不需要安装,直接解压即可使用
  cd /opt/smokeping
  cd 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
  //修改权限
  6、修改配置文件:
  1)vim /opt/smokeping/bin/smokeping
  Replace this:
  !/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.004000;
  Smokeping::main("etc/config.dist");
  把以上红色部分修改成如下加粗的部分:
  
  !/usr/bin/perl -w
  -*-perl-*-
  use lib qw(/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/RRDs/);
  use lib qw(/opt/smokeping/lib);
  use Smokeping 2.004000;
  Smokeping::main("/opt/smokeping/etc/config");
  2) vim /opt/smokeping/htdocs/smokeping.cgi
  Replace this:
  !/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.004000;
  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-linux-thread-multi/auto/RRDs);
  use lib qw(/opt/smokeping/lib);
  use CGI::Carp qw(fatalsToBrowser);
  use Smokeping 2.004000;
  Smokeping::cgi("/opt/smokeping/etc/config");
  3)vim /opt/smokeping/htdocs/tr.cgi
  Change this:
  !/usr/sepp/bin/speedy-5.8.8 -w
  use strict;
  use lib qw(/home/oposs/smokeping/software/lib);
  use lib qw(perl);
  把以上红色部分修改成如下加粗的部分:
  #!/usr/bin/speedy -w
  use strict;
  use lib qw(/opt/smokeping/lib);
  use lib qw(perl);
  7、创建HTTP访问的目录与文件
  mkdir -p /var/www/html/smokeping/img /var/www/html/smokeping/script/ /opt/smokeping/data /opt/smokeping/var
  chown -R apache:apache /var/www/html/smokeping/img
  ln -s /opt/smokeping/htdocs/cropper /var/www/html/smokeping/cropper
  ln -s /opt/smokeping/htdocs/resource /var/www/html/smokeping/resource
  ln -s /opt/smokeping/htdocs/script/Tr.js /var/www/html/smokeping/script/Tr.js
  ln -s /opt/smokeping/htdocs/smokeping.cgi /var/www/html/smokeping/smokeping.cgi
  ln -s /opt/smokeping/htdocs/tr.cgi /var/www/html/smokeping/tr.cgi
  8、修改traceroute权限
  chmod 4775 /bin/traceroute
  9、修改http配置文件
  vim /etc/httpd/conf/httpd.conf
  change > AddHandler cgi-script .cgi
  to > AddHandler cgi-script .cgi
  Under
  change> Options Indexes FollowSymLinks
  to > Options Indexes FollowSymLinks ExecCGI
  10、修改basepage.html配置文件
  vim /opt/smokeping/etc/basepage.html
  Change this:
  
  
  
  
  To this:
  
  
  
  
  11、修改tr.html配置
  vim /opt/smokeping/htdocs/tr.html
  Change this:
  
  
  
  SmokeTrace
  
  
  
  To this:
  
  
  
  SmokeTrace
  
  
  
  12、软连接
  ln -s /opt/smokeping/htdocs/tr.html /var/www/html/smokeping/tr.html
  13、修改配置文件,我的配置文件如下:
  *** General ***
  owner    =  Kang
  contact  = 1079841346@qq.com
  mailhost = smtp.qq.com
  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/img
  imgurl   = http://120.X.X.X/smokeping/img
  datadir  = /opt/smokeping/data
  piddir  = /opt/smokeping/var
  cgiurl   = http://120.X.X.Xsmokeping/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
  from = smokealert@company.xy
  +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 = /opt/smokeping/etc/basepage.html
  + 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/sbin/fping
  #*** Slaves ***
  #secrets=/opt/smokeping/etc/smokeping_secrets
  #+boomer
  #display_name=boomer
  #color=0000ff
  #+slave2
  #display_name=another
  #color=00ff00
  *** Targets ***

  menuextra =   onclick="window.open(this.href,this.target, \
  'width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no'); \
  return false;">(TR)
  probe = FPing
  menu = Top
  title = Network Latency Grapher
  remark = Welcome to the SmokePing website of Kang Company. \
  Here you will learn all about the latency of our network.
  + web
  menu= web
  #parents = owner:/Test/James location:/
  title = web
  ++ cu-guangzhou
  menu = cu-guangzhou
  title = cu-guangzhou
  +++ cu-guangzhou-1
  menu = cu-guangzhou-1
  title = cu-guangzhou-120.80.149.58
  host = 120.80.149.58
  +++ cu-guangzhou-2
  menu = cu-guangzhou-2
  title = cu-guangzhou-221.4.65.65
  host = 221.4.65.65
  +++ cu-guangzhou-3
  menu = cu-guangzhou-3
  title = cu-guangzhou-120.80.237.57
  host = 120.80.237.57
  +++ cu-guangzhou-4
  menu = cu-guangzhou-4
  title = cu-guangzhou-120.80.153.10
  host = 120.80.153.10
  ++ cu-shanghai
  menu = cu-shanghai
  title = cu-shanghai
  +++ cu-shanghai-1
  menu = cu-shanghai-1
  title = cu-shanghai-112.64.245.1
  host = 112.64.245.1
  +++ cu-shanghai-2
  menu = cu-shanghai-2
  title = cu-shanghai-112.64.245.158
  host =  112.64.245.158
  +++ cu-shanghai-3
  menu = ct-shanghai-3
  title = ct-shanghai-112.64.247.1
  host = 112.64.247.1
  ++ cu-beijing
  menu = cu-beijing
  title = cu-beijing
  +++ cu-beijing-1
  menu = cu-beijing-1
  title = cu-beijing-219.158.4.1
  host = 219.158.4.1
  +++ cu-beijing-2
  menu = cu-beijing-2
  title = cu-beijing-219.158.4.2
  host = 219.158.4.2
  +++ cu-beijing-3
  menu = cu-beijing-3
  title = cu-beijing-219.158.4.45
  host = 219.158.4.45
  +++ cu-beijing-4
  menu = cu-beijing-4
  title = cu-beijing-61.148.25.95
  host = 61.148.25.95
  +++ cu-beijing-5
  menu = cu-beijing-5
  title = cu-beijing-61.148.25.94
  host = 61.148.25.94
  ++MAN-guangzhou
  menu = MAN-guangzhou
  title = MAN-guangzhou
  +++MAN-guangzhou-1
  menu = MAN-guangzhou-1
  title = MAN-guangzhou-58.248.0.1
  host = 58.248.0.1
  +++MAN-guangzhou-2
  menu = MAN-guangzhou-2
  title = MAN-guangzhou-58.248.1.1
  host = 58.248.1.1
  +++MAN-guangzhou-3
  menu = MAN-guangzhou-3
  title = MAN-guangzhou-58.248.3.1
  host = 58.248.3.1
  +++ MAN-guangzhou-4
  menu = MAN-guangzhou-4
  title = MAN-guangzhou-58.248.4.1
  host = 58.248.4.1
  +++ MAN-guangzhou-5
  menu = MAN-guangzhou-5
  title = MAN-guangzhou-58.248.9.1
  host = 58.248.9.1
  ++MAN-shenzhen
  menu = MAN-shenzhen
  title = MAN-shenzhen
  +++MAN-shenzhen-1
  menu = MAN-shenzhen-1
  title = MAN-shenzhen-58.251.49.202
  host = 58.251.49.202
  +++MAN-shenzhen-2
  menu = MAN-shenzhen-2
  title = MAN-shenzhen-58.251.49.129
  host = 58.251.49.129
  +++MAN-shenzhen-3
  menu = MAN-shenzhen-3
  title = MAN-shenzhen-58.251.49.130
  host = 58.251.49.130
  +++MAN-shenzhen-4
  menu = MAN-shenzhen-4
  title = MAN-shenzhen-58.251.50.2
  host = 58.251.50.2
  +++MAN-shenzhen-5
  menu = MAN-shenzhen-5
  title = MAN-shenzhen-58.251.50.1
  host = 58.251.50.1
  ++MAN-dongguan
  menu = MAN-dongguan
  title = MAN-dongguan
  +++MAN-dongguan-1
  menu = MAN-dongguan-1
  title = MAN-dongguan-58.252.3.20
  host = 58.252.3.20
  +++MAN-dongguan-2
  menu = MAN-dongguan-2
  title = MAN-dongguan-58.252.3.1
  host = 58.252.3.1
  +++MAN-dongguan-3
  menu = MAN-dongguan-3
  title = MAN-dongguan-120.86.124.18
  host = 120.86.124.18
  +++MAN-dongguan-4
  menu = MAN-dongguan-4
  title = MAN-dongguan-120.86.124.21
  host = 120.86.124.21
  14、创建smokeping执行脚本
  touch /etc/init.d/smokeping
  //创建脚本文件
  
  vim /etc/init.d/smokeping
  //增加配置脚本,内容如下:
  #!/bin/bash
  #
  # chkconfig: 2345 80 05
  # 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
  start() {
  echo -n "Starting Smokeping: "
  /opt/smokeping/bin/smokeping >/dev/null 2>&1
  ### Create the lock file ###
  touch /var/lock/subsys/smokeping
  success $"Smokeping startup"
  echo
  }
  # Restart the service Smokeping
  stop() {
  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"
  echo
  }
  ### main logic ###
  case "$1" in
  start)
  start
  ;;
  stop)
  stop
  ;;
  status)
  status Smokeping
  ;;
  restart|reload|condrestart)
  stop
  start
  ;;
  *)
  echo $"Usage: $0 {start|stop|restart|reload|status}"
  exit 1
  esac
  exit 0
  chmod 755 /etc/init.d/smokeping
  //增加可执行权限
  15、自动运行等配置:
  # chkconfig smokeping on
  # chkconfig httpd on
  # service smokeping start
  Starting Smokeping: [ OK ]
  # service httpd start
  Starting httpd: [ OK ]
  补充:
  今天重新安装另外一台服务器,发现到了这和步,有个报错:
  Mon May 23 19:59:58 2011] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
  [Mon May 23 20:00:56 2011] [error] [client 192.168.10.103] Directory index forbidden by Options directive: /var/www/html/
  [Mon May 23 20:00:57 2011] [error] [client 192.168.10.103] File does not exist: /var/www/html/favicon.ico
  [Mon  May 23 20:01:07 2011] [error] [client 192.168.10.103] Symbolic link not  allowed or link target not accessible:  /var/www/html/smokeping/smokeping.cgi
  [Mon  May 23 20:02:32 2011] [error] [client 192.168.10.103] Symbolic link not  allowed or link target not accessible:  /var/www/html/smokeping/smokeping.cgi
  解决办法:
  vi /etc/selinux/config
  修改如下:
  SELINUX=disabled
  重启系统后恢复正常
  16、截图如下:



运维网声明 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-664362-1-1.html 上篇帖子: 让 Smokeping 支持中文 下篇帖子: smokeping config 详解
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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