smokeping install

smokeping install

  1. smokeping 简介

    1
    Smokeping 是一款用于网络性能监测的监控软件,通过它可以检测IDC的网络状况(如:延时,丢包率,是否BGP多线等),通过rrdtool制图方式,图形化地展示网络的时延情况,进而能够清楚的判断出网络的即时通信情况.
  2. smokeping install

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    //基础环境安装
    [root@localhost ~]# yum -y install epel-release
    [root@localhost ~]# yum -y install gcc gcc-c++ make cmake bison libtool autoconf automake zip unzip bzip2 zlib zlib-devel openssl openssl-devel pcre pcre-devel bison-devel ncurses-devel tcl tcl-devel perl-Digest-SHA1 GeoIP GeoIP-devel gperftools gperftools-devel libatomic_ops-devel gtest gtest-devel glibc-devel unixODBC-devel fop libperl libpython readline readline-devel python2-pip readline readline-devel readline-static openssl openssl-devel openssl-static sqlite-devel bzip2-devel bzip2-libs openldap-devel
    [root@localhost ~]# yum -y install git lftp ntpdate vim wget telnet dstat tree lrzsz net-tools nmap-ncat nmap sysstat

    //perl版本
    [root@localhost ~]# perl -v|head -2|tail -1
    This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi

    //curl版本
    [root@zabbix-server-company ~]# curl -V
    curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.15.4 zlib/1.2.7 libidn/1.28 libssh2/1.4.3

    //ssh版本
    [root@localhost ~]# ssh -V
    OpenSSH_6.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013

    //fping安装
    [root@localhost ~]# yum -y install fping

    //echoping安装
    [root@localhost app]# yum -y install popt popt-devel libidn libidn-devel
    [root@localhost app]# wget https://fossies.org/linux/misc/old/echoping-6.0.2.tar.gz
    [root@localhost app]# tar xzf echoping-6.0.2.tar.gz
    [root@localhost app]# cd echoping-6.0.2
    [root@localhost echoping-6.0.2]# ./configure --prefix=/mnt/app/echoping
    [root@localhost echoping-6.0.2]# make
    [root@localhost echoping-6.0.2]# make install
    [root@localhost echoping-6.0.2]# echo "ECHOPING_HOME=/mnt/app/echoping" |tee /etc/profile.d/echoping.sh
    [root@localhost echoping-6.0.2]# echo "ECHOPING_BIN=\${ECHOPING_HOME}/bin" |tee -a /etc/profile.d/echoping.sh
    [root@localhost echoping-6.0.2]# echo "export PATH=\${ECHOPING_BIN}:\$PATH" |tee -a /etc/profile.d/echoping.sh
    [root@localhost echoping-6.0.2]# source /etc/profile.d/echoping.sh

    //dig安装
    [root@localhost ~]# yum install bind-utils //dig命令

    //rrdtool安装
    [root@localhost ~]# yum -y install rrdtool rrdtool-perl

    //httpd安装
    [root@localhost ~]# yum -y install httpd

    //smokeping安装
    [root@localhost ~]# yum -y install smokeping
  3. smokeping config

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    [root@localhost ~]# useradd -s /sbin/nologin smokeping
    [root@localhost ~]# vim /etc/smokeping/config
    *** General ***
    owner = {姓名}
    contact = {邮箱}
    mailhost = {邮箱服务器地址}
    sendmail = /usr/sbin/sendmail
    imgcache = /mnt/data/smokeping/images
    imgurl = /smokeping/images
    datadir = /mnt/data/smokeping/rrd
    piddir = /var/run/smokeping
    cgiurl = http://{192.168.13.202}/smokeping/sm.cgi
    smokemail = /etc/smokeping/smokemail
    tmail = /etc/smokeping/tmail
    syslogfacility = local0
    *** Alerts ***
    to = {接收邮箱地址}
    from = {发送邮箱地址}
    +someloss
    type = loss
    pattern = >0%,*12*,>0%,*12*,>0%
    comment = loss 3 times in a row
    *** Database ***
    step = 60
    pings = 20
    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 = /etc/smokeping/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
    *** Probes ***
    + FPing
    binary = /usr/sbin/fping
    *** Slaves ***
    secrets=/etc/smokeping/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 <b>众荟</b>. \
    Here you will learn all about the latency of our network.
    + Ping
    menu = {XX机房}
    title = {}监控统计}
    ++ AliCloud
    menu = 阿里云网络监控
    title = 阿里云网络监控列表
    host = /Ping/AliCloud/{xx1} /Ping/AliCloud/{xx2}
    +++ {xx1}
    menu = {xx1}
    title = {xx1}
    alerts = someloss
    host = {xx1 服务器地址}
    +++ {xx2}
    menu = {xx2}
    title = {xx2}
    alerts = someloss
    host = {xx2 服务器地址}
    [root@localhost ~]# mkdir -p /mnt/data/smokeping/{images,rrd}
    [root@localhost ~]# chown -R apache /mnt/data/smokeping/images
  4. smokeping 中文显示

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    [root@localhost ~]# yum -y install wqy-zenhei-fonts
    [root@localhost ~]# vim /etc/smokeping/config
    *** Presentation ***
    charset = utf-8
    [root@localhost ~]# vim /usr/share/smokeping/Smokeping/Graphs.pm
    在第147行下边插入下边一行:
    '--font TITLE:20:"WenQuanYi Zen Hei Mono"',
    例如:
    my ($graphret,$xs,$ys) = RRDs::graph
    ("dummy",
    '--start', $tasks[0][1],
    '--end', $tasks[0][2],
    '--font TITLE:20:"WenQuanYi Zen Hei Mono"',
    "DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",
    'PRINT:maxping:MAX:%le' );
  5. httpd配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    [root@zabbix-server-company ~]# cat /etc/httpd/conf.d/smokeping.conf
    <Directory "/usr/share/smokeping" >
    Require local
    Require ip 0.0.0.0
    # Require host example.org
    Options Indexes FollowSymLinks
    Options +ExecCGI
    AllowOverride None
    DirectoryIndex smokeping.fcgi
    Require all granted
    </Directory>

    <Directory "/mnt/data/smokeping" >
    Require local
    Require ip 0.0.0.0
    # Require host example.org
    AllowOverride None
    Require all granted
    </Directory>

    # .fcgi : smokeping by mod_fcgid aka fastcgi
    # _cgi : plain old fashion cgi
    ScriptAlias /smokeping/sm.cgi /usr/share/smokeping/cgi/smokeping.fcgi
    #ScriptAlias /smokeping/sm.cgi /usr/share/smokeping/cgi/smokeping_cgi

    Alias /smokeping/images /mnt/data/smokeping/images
    Alias /smokeping /usr/share/smokeping/htdocs


    注意:
    1.httpd 版本是2.4
    2.每次更新完smokeping的配置文件conf后,需要重启httpd服务
  6. 做软连接

    1
    [root@localhost ~]# ln -s /usr/share/smokeping/cgi/smokeping_cgi /usr/share/smokeping/htdocs/smokeping.fcgi
  7. 启动服务

    1
    2
    [root@localhost ~]# systemctl start smokeping
    [root@localhost ~]# systemctl restart httpd