Smokeping部署

环境介绍

  1. Smokeping 是一款用于网络性能监测的监控软件,通过它可以在自己公司IDC的网络状况,如延时,丢包率,是否BGP多线等,通过rrdtool制图方式,图形化地展示网络的时延情况,进而能够清楚的判断出网络的即时通信情况。
  2. Smokeping 需要多个包的支持,可以逐个安装,本次采用yum和编译安装两种方式。
  3. 相关编译包链接:https://pan.baidu.com/s/1be1YZDwYcjBN8CxrcnHIgw 密码:lba4
  4. Smokeping建议安装在Centos 6.7或CentOS 7以上的版本中,本次采用版本为CentOS-6.9-x86_64-bin-DVD1 。建议关闭防火墙与SElinux
  5. 文次采用编译包版本分别为:smokeping-2.6.9.tar.gz、fping-3.10.tar.gz、echoping_6.0.2.orig.tar.gz。可通过WinSCP先行导入至CentOS内。

     

安装

  1. 安装依赖包

    yum install -y perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel popt popt-devel libidn libidn-devel

     

  2. 解压、编译安装fping

    tar xf fping-3.10.tar.gz

    cd fping-3.10

    ./configure

    make && make install

 

  1. 解压、编译安装echoping

    tar xf echoping_6.0.2.tar.gz

    cd echoping-6.0.2

    ./configure

    make && make install

     

  2. 解压、编译安装smokeping

    tar xf smokeping-2.6.9.tar.gz

    cd smokeping-2.6.9

    ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

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

    /usr/bin/gmake install

     

  3. 配置 smokeping

    cd /usr/local/smokeping/

    mkdir cache data var

    touch /var/log/smokeping.log

    chown apache:apache cache data var

    chown apache:apache /var/log/smokeping.log

    chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

    cd /usr/local/smokeping/htdocs

    mv smokeping.fcgi.dist smokeping.fcgi

    cd /usr/local/smokeping/etc

    mv config.dist config

     

  4. 更改配置文件

    vim /usr/local/smokeping/etc/config

    主要修改如下内容:

    cgiurl = http://some.url/smokeping.cgià cgiurl = http://Linux自身IP/smokeping.cgi

     

    *** Database ***

    #step = 300

    step = 60 #此处建议改为 60 , 一分钟采集一次数据

    pings = 20

     

  5. 编辑apache配置文件

    vim /etc/httpd/conf/httpd.conf

    #在文末添加如下:

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

    Alias /cropper "/usr/local/smokeping/htdocs/cropper/"

    Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"

    AllowOverride None

    Options All

    AddHandler cgi-script .fcgi .cgi

    Order allow,deny

    Allow from all

    DirectoryIndex smokeping.fcgi

     

  6. 图像浏览界面的中文支持
  • yum -y install wqy-zenhei-fonts.noarch #安装字体
  • vim /usr/local/smokeping/etc/config #编辑smokeping的配置文件

在第50行添加

charset = utf-8 #添加此行

Smokeping部署_第1张图片

  • vim /usr/local/smokeping/lib/Smokeping/Graphs.pm #编辑Graphs.pm

    '--font TITLE:20:"WenQuanYi Zen Hei Mono"', #第147行下插入一行

Smokeping部署_第2张图片

 

  1. 自定义测试数据(部分运营商DNS会有变更,可自行查询更改或添加)

    vim /usr/local/smokeping/etc/config #config 配置文件的最后边插入

+ Other

menu = 三大网络监控

title = 监控统计

++ dianxin

menu = 电信网络监控

title = 电信网络监控列表

title = 监控统计

++ dianxin

menu = 电信网络监控

title = CTCC monitor

host = /Other/dianxin/dianxin-bj /Other/dianxin/dianxin-tj /Other/dianxin/dianxin-sj /Other/dianxin/dianxin-gx /Other/dianxin/dianxin-xm /Other/dianxin/dianxin-hun /Other/dianxin/dianxin-hlj /Other/dianxin/dianxin-sc /Other/dianxin/dianxin-nx /Other/dianxin/dianxin-gs /Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz /Other/dianxin/dianxin-xg /Other/dianxin/dianxin-am

 

+++ dianxin-bj

menu = 北京

title = 北京

alerts = someloss

host = 202.96.199.133

 

+++ dianxin-tj

menu = 天津

title = 天津

alerts = someloss

host = 219.150.32.132

 

+++ dianxin-sj

menu = 深圳

title = 深圳

alerts = someloss

host = 202.96.154.15

 

+++ dianxin-gx

menu = 广西

title = 广西

alerts = someloss

host = 202.103.224.68

 

+++ dianxin-xm

menu = 厦门

title = 厦门

alerts = someloss

host = 202.101.103.55

 

+++ dianxin-hun

menu = 湖南

title = 湖南

alerts = someloss

host = 202.103.0.68

 

+++ dianxin-hlj

menu = 黑龙江

title = 黑龙江

alerts = someloss

host = 202.97.224.68

 

+++ dianxin-sc

menu = 四川

title = 四川

alerts = someloss

host = 61.139.2.69

 

+++ dianxin-nx

menu = 宁夏

title = 宁夏

alerts = someloss

host = 202.100.0.68

 

+++ dianxin-gs

menu = 甘肃

title = 甘肃

alerts = someloss

host = 202.100.72.13

 

+++ dianxin-sh

menu = 上海

title = 上海

alerts = someloss

host = 116.228.111.118

 

+++ dianxin-gz

menu = 广东

title = 广东

alerts = someloss

host = 113.111.211.22

 

+++ dianxin-xg

menu = 香港

title = 香港

alerts = someloss

host = 205.252.144.228

 

+++ dianxin-am

menu = 澳门

title = 澳门

alerts = someloss

host = 202.172.3.8

++ liantong

menu = 联通网络监控

title = CUCC monitor

host = /Other/liantong/liantong-bj /Other/liantong/liantong-hlj /Other/liantong/liantong-tj /Other/liantong/liantong-sc /Other/liantong/liantong-sh /Other/liantong/liantong-gz

 

+++ liantong-bj

menu = 北京联通

title = 北京联通

alerts = someloss

host = 61.135.169.121

 

+++ liantong-hlj

menu = 黑龙江联通

title = 黑龙江联通

alerts = someloss

host = 202.97.224.69

 

+++ liantong-tj

menu = 天津联通

title = 天津联通

alerts = someloss

host = 202.99.96.68

 

+++ liantong-sc

menu = 四川联通

title = 四川联通

alerts = someloss

host = 119.6.6.6

 

+++ liantong-sh

menu = 上海联通

title = 上海联通

alerts = someloss

host = 210.22.84.3

 

+++ liantong-gz

menu = 广东联通

title = 广东联通

alerts = someloss

host = 221.5.88.88

 

++ yidong

menu = 移动网络监控

title = CMCC monitor

host = /Other/yidong/yidong-bj /Other/yidong/yidong-hlj /Other/yidong/yidong-tj /Other/yidong/yidong-sc /Other/yidong/yidong-sh /Other/yidong/yidong-gz

 

+++ yidong-bj

menu = 北京移动

title = 北京移动

alerts = someloss

host = 221.130.33.52

 

+++ yidong-hlj

menu = 黑龙江移动

title = 黑龙江移动

alerts = someloss

host = 211.137.241.35

 

+++ yidong-tj

menu = 天津移动

title = 天津移动

alerts = someloss

host = 211.137.160.5

 

+++ yidong-sc

menu = 四川移动

title = 四川移动

alerts = someloss

host = 218.201.4.3

 

+++ yidong-sh

menu = 上海移动

title = 上海移动

alerts = someloss

host = 117.131.19.23

 

+++ yidong-gz

menu = 广东移动

title = 广东移动

alerts = someloss

host = 211.136.192.6

 

10. smokeping的默认配置文件110行的fping安装目录与此次安装目录不相符需修改

vim /usr/local/smokeping/etc/config

##第110更改fping的目录为

binary = /usr/local/sbin/fping

 

11. 启动apache和smokeping&设置环境变量

    /etc/init.d/httpd start

    /usr/local/smokeping/bin/smokeping

    echo 'export PATH=/usr/local/smokeping/bin/:$PATH' >> /etc/profile

 

12.启动Apache时出现报错:

httpd: Could not reliably determine the server's fully qualified domain name

 

解决方法:

vi /etc/httpd/conf/httpd.conf

    在227行左右加入一句 ServerName localhost:80    

Smokeping部署_第3张图片

 

查看效果

浏览器输入:http://IP/smokeping,即可进入smokeping页面查看流量状况、辅助我们分析网络质量。

 

根据预定义的规则,我们可以查看到最近3小时、30小时、10天、400天的外网通讯质量。并且可以点选取某时间段内的丢包、延迟情况。

 

至此,Smokeping主体安装工作已完成。

你可能感兴趣的:(Linux)