zoukankan      html  css  js  c++  java
  • 网络监控-----smokping搭建

    环境:centos7.2  yum源为163.

     systemctl stop firewalld.service

    setenforce 0

    yum groupinstall "Compatibility libraries" "Base" "Development tools" -y

    yum -y install cpan perl perl-FCGI perl-CGI perl-Digest-HMAC perl-Net-Telnet perl-Net-OpenSSH perl-Net-SNMPperl-LDAP perl-Net-DNS perl-IO-Pty-Easy perl-Test-Simple perl-Sys-Syslog perl-libwww-perlperl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-Time-HiResperl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl fping httpd httpd-devel gccmake wget libxml2-devel libpng-devel glib pango pango-devel freetypefreetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel mod_fcgidscreen

    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 perl-CGI-SpeedyCGI perl-Sys-Syslog popt-devel libidn-devel fping

    安装echopping 

    tar xvfechoping-6.0.2.tar.gz
    cd echoping-6.0.2
    ./configure--prefix=/usr/local/echoping
    make && makeinstall
     
    install smokeping
    tar xf smokeping-2.6.11.tar.gz
    export PERL5LIB=/usr/local/smokeping/thirdparty/lib/perl5/
    ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
    ./configure --prefix=/usr/local/smokeping
    /usr/bin/gmake install
    #fcgi文件
    cp /usr/local/smokeping/htdocs/smokeping.fcgi.dist /usr/local/smokeping/htdocs/smokeping.fcgi 
    #主配置文件
    cp /usr/local/smokeping/etc/config.dist/usr/local/smokeping/etc/config
     
     
    cd /usr/local/smokeping/
    mkdir cache data var

     touch /var/log/smokeping.log
     chown apache:apache cache/ data/ var/ /var/log

    vi /usr/local/smokeping/etc/config

    *** General ***

    owner = Peter Random
    contact = some@address.nowhere
    mailhost = my.mail.host
    sendmail = /usr/sbin/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 = /usr/local/smokeping/cache
    imgurl = cache
    datadir = /usr/local/smokeping/data
    piddir = /usr/local/smokeping/var
    cgiurl = http://192.168.235.129/smokeping.cgi
    smokemail = /usr/local/smokeping/etc/smokemail.dist
    tmail = /usr/local/smokeping/etc/tmail.dist
    # 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 = hanlei@zhangyue.com
    from = smokealert@company.xy

    +someloss
    type = loss
    # in percent
    pattern = >0%,*12*,>0%,*12*,>0%
    comment = loss 3 times in a row

    *** Database ***

    step = 60
    pings = 60

    # 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 = /usr/local/smokeping/etc/basepage.html.dist

    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

    *** Probes ***

    + FPing

    binary = /usr/sbin/fping

    *** Slaves ***
    secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
    +boomer
    display_name=boomer
    color=0000ff

    +slave2
    display_name=another
    color=00ff00

    *** Targets ***

    probe = FPing
    menu = TEST
    title = TEST


    +T
    menu= TEST
    title = TEST
    ++ baidu
    menu = test
    title = test
    host = 115.239.210.27

    yum -y install wqy-zenhei-fonts

    vim/usr/local/smokeping/lib/Smokeping/Graphs.pm

            my$val = 0;

            formy $host (@hosts){

                my ($graphret,$xs,$ys) = RRDs::graph

               ("dummy",

               '--start', $tasks[0][1],

               '--end', $tasks[0][2],

                '--font TITLE:20"WenQuanYiZen Hei Mono"',

               "DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",

               'PRINT:maxping:MAX:%le' );

               my $ERROR = RRDs::error();

    htpasswd -c /usr/local/smokeping/htdocs/htpasswd smokeping
    chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
     
     
    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"
    <Directory "/usr/local/smokeping">
    AllowOverride None
    Options All
    AddHandler cgi-script .fcgi .cgi
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
    AuthName "Smokeping"
    AuthType Basic
    AuthUserFile /usr/local/smokeping/htdocs/htpasswd
    Require valid-user
    DirectoryIndex smokeping.fcgi
    </Directory>

    重启

    /usr/local/smokeping/bin/smokeping --restart
    /usr/local/smokeping/bin/smokeping --reload
    pkill smokeping
    /usr/local/smokeping/bin/smokeping
     
     
    systemctl start httpd
    /usr/local/smokeping/bin/smokeping
     
     
    访问主机ip测试
     
     
     
     
  • 相关阅读:
    HDU 1166 敌兵布阵 我的第一棵树,线段树,树状数组。
    HDU 2544 最短路 第一个图论问题。
    位运算简介及实用技巧(三):进阶篇(2)
    用匈牙利算法求二分图的最大匹配
    求两个字符串的最长公共子序列的长度(动态规划)
    搜索之深度优先【迷宫搜索】(判断是否n步恰好可以到达某点)
    HDU 2955 Robberies
    STL简介
    HDU 1257 最少拦截系统
    HDU 2034 人见人爱AB
  • 原文地址:https://www.cnblogs.com/han1094/p/6900001.html
Copyright © 2011-2022 走看看