网络检测工具smokeping安装配置

smokeping是MRTG和RRDtool作者Tobi Oetiker的作品,主要用于对IDC网络质量,稳定性等做检测,主要功能包括常规的ping,dig,echoping,curl等,依赖rrdtool来画图。选择smokeping我觉得有以下原因:

1,最佳的画图功能,延迟和丢包用颜色和阴影表示很直观。

2,免费和开源。

3,支持主从的分布式模式。

4,可以自定义报警功能。

smokeping官方网站:http://oss.oetiker.ch/smokeping/

如下安装配置的系统为:redhat 5.8 + Perl 5.8.8

smokeping官方对perl版本要求:Perl 5.8.8 or later

一,安装

官方下载地址:http://oss.oetiker.ch/smokeping/pub/

1,安装yum源,这个rpmforge源中有smokeping所需的依赖包:

# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

安装成功之后会在yum仓库配置中多一个repo文件:

[[email protected]_82_215 soft]# ls /etc/yum.repos.d/
5AS.repo  5ASU5.repo  mirrors-rpmforge  redhat.repo  rhel-debuginfo.repo  rpmforge.repo

2,安装依赖包:

# 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-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI

3,安装最新版smokeping:

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

# tar xf smokeping-2.6.9.tar.gz

# cd smokeping-2.6.9/

# ./configure --prefix=/opt/smokeping

注意:

1,configure之后,如果依赖的perl module没有安装好,会提示用脚本进行安装。根据提示,直接运行脚本即可。如果脚本运行之后,仍然有问题,参考第2条

2,如果configure时候,出现如下报错,则是FCGI模块没有安装:

checking checking for perl module ‘FCGI‘... Failed
checking checking for perl module ‘CGI‘... Ok
checking checking for perl module ‘CGI::Fast‘... Failed

安装FCGI模块:

# perl -MCPAN -e ‘install FCGI‘

如果提示未安装cpan,则用yum进行安装

# yum install cpan

然后在安装:

# ./configure --prefix=/opt/smokeping

# make install

查看安装目录:

[[email protected]_82_215 smokeping]# ls
bin  etc  htdocs  lib  share  thirdparty

4,在smokeping目录中有很多以dist结尾的配置文件,需要把dist结尾的文件重命名,配置才能生效:

# cd htdocs

# cp smokeping.fcgi.dist smokeping.fcgi

# 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和apache配置文件

1,修改二进制命令权限:

# chmod 4775 /bin/traceroute

2,建立下面三个目录用于保存smokeping的数据等

# mkdir /opt/smokeping/data

# mkdir /opt/smokeping/var

# mkdir /opt/smokeping/htdocs/cache

# mkdir -p /opt/smokeping/htdocs/img

# chown -R apache:apache /opt/smokeping

3,指定rrdtool的perl模块库文件路径

先找到系统上库文件位置:(不同系统或者不同的perl-rrdtool的安装方法,位置会不同)

[[email protected]_82_215 ~]# rpm -qa|grep rrdtool
perl-rrdtool-1.4.7-1.el5.rf
rrdtool-1.2.27-4.el5
rrdtool-1.4.7-1.el5.rf

[[email protected]_82_215 ~]# rpm -ql perl-rrdtool-1.4.7-1.el5.rf
/usr/lib/perl5/vendor_perl/5.8.8/RRDp.pm
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/RRDs.pm
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs/RRDs.bs
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs/RRDs.so
/usr/share/doc/perl-rrdtool-1.4.7
/usr/share/doc/perl-rrdtool-1.4.7/MANIFEST
/usr/share/doc/perl-rrdtool-1.4.7/README
/usr/share/man/man3/RRDp.3pm.gz
/usr/share/man/man3/RRDs.3pm.gz

# vim /opt/smokeping/bin/smokeping_cgi

把如下行:

#use lib qw(); # PERL5LIB

修改为:
use lib qw(/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs); # PERL5LIB

4,修改apache配置文件

# vim /etc/httpd/conf/httpd.conf

添加下面虚拟主机:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName 10.13.82.215
    DocumentRoot /opt/smokeping/htdocs
    ErrorLog logs/174-error_log
    CustomLog logs/174-access_log common
    <Directory "/opt/smokeping/htdocs">
      Options FollowSymLinks ExecCGI
      AllowOverride None
      DirectoryIndex index.html smokeping.fcgi
      AddHandler cgi-script fcgi .cgi
      Order allow,deny
      Allow from all
      </Directory>
</VirtualHost>

重启apache:

# /etc/init.d/httpd restart

5,修改smokeping配置文件

# vim config
*** General ***

owner    = shengjiali
contact  = [email protected]
mailhost = mail.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 = /opt/smokeping/htdocs/img
imgurl   = http://10.13.82.215/img
datadir  = /opt/smokeping/data
piddir  = /opt/smokeping/var
cgiurl   = http://10.13.82.215/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 = [email protected] 
from = [email protected]

+someloss
type = loss
# in percent
#pattern = >0%,*12*,>0%,*12*,>0%
pattern = >0%,*10*,>0%,*10*,>0%

comment = loss 3 times  in a row

+manyloss

type = loss

pattern = >15%,*30*,>15%,*30*,>15%

comment = loss 5 packages in 30 continuous 3 times.

+rttbad
type = rtt
pattern = ==S,>50,>50 # in milliseconds
comment = For more than two consecutive 50-millisecond delay

*** Database ***

step     = 60
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
charset=UTF-8

+ 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

#如下所示,定义多个FPing,然后在最下面node定义的时候(如下配置中的红色字体),使用不同的probe,就实现了探测的多进程,多与机器多的检测,提升了效率。
*** Probes ***

+ FPing

binary = /usr/sbin/fping
blazemode = true

++ FPing

++ FPing1
pings = 20
step = 60

++ FPing2
pings = 20
step = 60

++ FPing3
pings = 20
step = 60

++ FPing4
pings = 20
step = 60

++ FPing5
pings = 20
step = 60

++ FPing6
pings = 20
step = 60

++ FPing7
pings = 20
step = 60

++ FPing8
pings = 20
step = 60

++ FPing9
pings = 20
step = 60

++ FPing10
pings = 20
step = 60

*** Slaves ***
secrets=/opt/smokeping/etc/smokeping_secrets
+boomer
display_name=boomer
color=0000ff

+slave2
display_name=another
color=00ff00

*** Targets ***

probe = FPing

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

+ net_yd_eth1
menu = 移动机房外网
title = yd-->外网

++ baidu_node
probe = FPing1
menu = 百度_node
#alerts = someloss
title = yd--->61.135.169.125(百度)
host = 61.135.169.125

++ sohu_node
probe = FPing2
menu = 搜狐_node
#alerts = someloss
title = yd--->123.125.116.12(搜狐)
host = 123.125.116.12

++ zong_yd_eth1
menu = 移动机房外网_汇总 
title = yd--->移动机房外网_汇总
host = /net_yd_eth1/baidu_node /net_yd_eth1/sohu_node

注意:

1),配置文件如果有中文的话,不仅如上配置文件中要设置charset=UTF-8,系统也要设置中文字符集在/etc/profile中加入export LANG=zh_CN.UTF-8,并且所有的xshell或者crt中断也要设置成utf-8格式,这样就不会影响中文在配置文件中的编辑和中文在访问页面的展示。

2),配置的详细信息可以参考官方网站:http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html

6,重启脚本定制

# 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 +x /etc/init.d/smokeping

7,smokeping服务启动

正常启动:

# /etc/init.d/smokeping start

# /opt/smokeping/bin/smokeping

调试故障时,使用debug模式启动:

/opt/smokeping/bin/smokeping --config=/opt/smokeping/etc/config --debug

三,访问页面

http://10.13.82.215/

页面效果如下:

网络检测工具smokeping安装配置

时间: 2024-10-12 08:32:38

网络检测工具smokeping安装配置的相关文章

实战1 网络监控cacti的安装配置

一.cacti概述二.cacti工作流程三.cacti安装四.配置cacti监控本机 环境: 操作系统:CentOS 6.4 x86_64软件:Cacti-0.8.7e 官方网站:http://www.cacti.net 一.cacti概述Cacti 在英文中的意思是仙人掌的意思,Cacti是一套基于PHP.MySQL.SNMP及RRDTool开发的网络流量监测图形分析工具.它通过snmpget来获取数据,使用 RRDtool绘画图形,它的界面非常漂亮,能让你根本无需明白rrdtool的参数能轻

第【一】部分Netzob项目工具的安装配置by tsy

声明: 1)本报告由博客园bitpeach撰写,版权所有,免费转载,请注明出处,并请勿作商业用途. 2)若本文档内有侵权文字或图片等内容,请联系作者bitpeach删除相应部分. 3)本文档内容涉及Netzob工具的安装配置,请勿认为本文是讲述使用,Netzob的使用是不在本文讲述的,下一篇博文应该会写Netzob的使用手册. 4)仅仅作为参考用途,抛砖引玉,不作为证据证明用途,请自行取舍,核实引用.文中图片大多为本人原创,如有引用他人图片会注明的. 0目录 目录 0目录    1 [1]引言 

Unix下C程序内存泄漏检测工具Valgrind安装与使用

Unix下C程序内存泄漏检测工具Valgrind安装与使用 Valgrind是一款用于内存调试.内存泄漏检测以及性能分析的软件开发工具. Valgrind的最初作者是Julian Seward,他于2006年由于在开发Valgrind上的工作获得了第二届Google-O'Reilly开源代码奖. Valgrind遵守GNU通用公共许可证条款,是一款自由软件. 官网 http://www.valgrind.org 下载与安装 #wget http://www.valgrind.org/downlo

代码静态分析工具PC-LINT安装配置

代码静态分析工具PC-LINT安装配置--step by step                             作者:ehui928                             2006-5-20 PC-Lint是C/C++软件代码静态分析工具,你可以把它看作是一种更加严格的编译器.它不仅可以检查出一般的语法错误,还可以检查出那些虽然符合语法要求但不易发现的潜在错误. C语言的灵活性带来了代码效率的提升,但相应带来了代码编写的随意性,另外C编译器不进行强制类型检查,也带来

mysql物理备份工具Xtrabackup安装配置

mysql物理备份工具Xtrabackup安装配置 1????Xtrabackup工具介绍 Xtrabackup是一个对InnoDB做物理数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品. Xtrabackup有两个主要的工具:xtrabackup.innobackupex (1)xtrabackup只能备份InnoDB和XtraDB两种数据表,而不能备份MyISAM数据表. (2)innobackupex是用来备份非Inn

Iperf网络检测工具

一.介绍 Iperf是一个网络性能测试工具.Iperf可以测试TCP和UDP带宽质量.Iperf可以测量最大TCP带宽,具有多种参数和UDP特性. Iperf可以报告带宽,延迟抖动和数据包丢失.利用Iperf这一特性,可以用来测试一些网络设备如路由器,防火墙,交换机等的性能. Iperf有两种版本,windows版和linux版本. linux最新版本为iperf 3.1.4,下载地址:https://iperf.fr/download/source/iperf-3.1.3-source.tar

Linux性能实时监测工具netdata安装配置

netdata:功能强大的实时性能检测工具,展示地址. github地址:https://github.com/firehol/netdata 本文介绍在CentOS 6.7下安装netdata 1.环境准备 yum install zlib-devel libuuid-devel libmnl-devel gcc make git autoconf autogen automake pkgconfig curl jq nodejs 2.安装netdata git clone https://g

CentOS6 smokeping安装配置

smokeping安装部署文档: 下载smokeping http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz 安装第三方源 rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm 安装依赖包 yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl

电脑重装系统后各种环境和工具的安装配置

今天把电脑重装了,开始重新安装配置各种工具吧. 1.jdk的安装配置: 1.1官网下载jdk1.8.0_171 1.2安装路径见下图: 1.3配置环境变量: 1.3.1此电脑->高级系统设置->环境变量-> 在用户变量中: 新建java_home(可大写),选择d:/java目录 点击Path变量编辑->点击新建->选择jdk/bin目录 注意:无需配置CLASSPATH,这是十年前的jdk版本干的事了,也不要管"java"目录下的jre目录. (OK)