zoukankan      html  css  js  c++  java
  • tcp状态统计脚本

    tcp_status_ss.sh
    
    #!/bin/bash 
    #scripts for tcp status 
    function SYNRECV { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'SYN-RECV' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function ESTAB { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'ESTAB' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function FINWAIT1 { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'FIN-WAIT-1' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function FINWAIT2 { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'FIN-WAIT-2' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function TIMEWAIT { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'TIME-WAIT' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function LASTACK { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'LAST-ACK' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function LISTEN { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'LISTEN' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    } 
    function CLOSE-WAIT { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'CLOSE-WAIT' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    }
    function CLOSING { 
        n=`/usr/sbin/ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}' | grep 'CLOSING' | awk '{print $2}'`
        if [ "x$n" == "x" ]; then echo 0; else echo $n; fi
    }
    function ALL {
        /usr/sbin/ss -ant | wc -l
    }
    
    $1
  • 相关阅读:
    第十一作业
    第十次作业
    06 逻辑回归
    05 线性回归算法
    04 K均值算法--应用
    03 K均值算法
    02 机器学习相关数学基础
    01 机器学习概述
    15 语法制导的语义翻译
    014 算符优先分析
  • 原文地址:https://www.cnblogs.com/qingchen-24K/p/7245063.html
Copyright © 2011-2022 走看看