• 网络链路质量监控smokeping


    作者:邓聪聪

    1.安装smokeping,需要下载三个软件

    wget http://www.fping.org/dist/fping-3.10.tar.gz
    wget https://fossies.org/linux/misc/old/echoping-6.0.2.tar.gz
    wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz

    2.安装smokeping的依赖包,已经apache服务

    yum install perl perl-Sys-Syslog podofo 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 mod_fcgid bind-utils -y

    3.解压文件编译安装

       

    tar xf fping-3.10.tar.gz
    cd fping-3.10
    ./configure
    make && make install
    
    
    tar xf echoping-6.0.2.tar.gz
    cd echoping-6.0.2
    ./configure
    make && make install
    
    
    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

    4.配置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

    5.编辑配置文件

    主要修改如下内容:
    #cgiurl = http://some.url/smokeping.cgi
    cgiurl = http://访问所需要的IP/smokeping.cgi
    
    *** Database ***
    #step = 300
    step = 60     #此处建议改为 60 , 一分钟采集一次数据
    pings = 20

    6.apache使用虚拟主机的子文件配置

    <VirtualHost *:81>
        ServerName 192.168.10.236
        DocumentRoot /usr/local/smokeping/htdocs
        ErrorLog logs/smokeping_error.log
        CustomLog logs/smokeping_access.log  common
            Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
            Alias /cache "/usr/local/smokeping/cache"
            Alias /cropper "/usr/local/smokeping/htdocs/cropper"
            <Directory /usr/local/smokeping>
            AllowOverride None
            AddHandler cgi-script cgi fcgi
            Options ExecCGI
            Order allow,deny
            Allow from all
            AuthName "Smokeping Access"  #认证控制
            AuthType Basic
            AuthUserFile /usr/local/smokeping/htdocs/htpasswd
            Require valid-user
            DirectoryIndex smokeping.fcgi
           </Directory>
    </VirtualHost>

    #认证控制部分是为了安全和保密
    cd /usr/local/smokeping/htdocs
    htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin #然后根据提示数据密码

    完成之后修改验证密码文件权限
    chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

    7.重启http服务和smokeping

    #重启httpd,和smokeping服务
    systemctl restart httpd
    /usr/local/smokeping/bin/smokeping  --logfile=/var/log/smokeping.log

     8.启动脚本

    #!/bin/bash
    #
    # Description: Smokeping init.d script
    # Get function from functions library
    . /etc/init.d/functions
    # Start the service Smokeping
    function start() {
                    echo -n "Starting Smokeping: "
                    /usr/local/smokeping/bin/smokeping >/dev/null 2>&1
                    ### Create the lock file ###
                    touch /var/lock/subsys/smokeping
                    success $"Smokeping startup"
                    echo
    }
    # Restart the service Smokeping
    function stop() {
                    echo -n "Stopping Smokeping: "
                    kill -9 `ps ax |grep "/usr/local/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
    }
    #Show status about Smokeping
    function status() {
                    NUM="`ps -ef|grep smokeping|grep -v grep|wc -l`"
                    if [ "$NUM" == "0" ];then
                       echo "Smokeping is not run"
                    else
                       echo "Smokeping is running"
                    fi
    
    }
    ### main logic ###
    case "$1" in
    start)
            start
            ;;
    stop)
            stop
            ;;
    status)
            status
            ;;
    restart|reload)
            stop
            start
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart|reload|status}"
    exit 1
    esac
    exit 0
  • 相关阅读:
    怎么使用ZYNQ PL的GPIO外设
    找不到串口的问题
    找不到串口的问题
    Enable GPOI on EMIO Interface的XPS14.4中显示为0的问题
    ZEDBOARD移植UCOS II 教程
    Nodejs中的EventEmitter
    JSinArray检查数组中是否存在某个值
    vim split
    NoSQL数据库:Redis适用场景及产品定位
    vim学习笔记
  • 原文地址:https://www.cnblogs.com/dengcongcong/p/11613584.html
Copyright © 2020-2023  润新知