首页 > 代码库 > Linux Shell 网络层监控脚本(监控包括:连接数、句柄数及根据监控反馈结果分析)

Linux Shell 网络层监控脚本(监控包括:连接数、句柄数及根据监控反馈结果分析)

脚本监控:

获取最大句柄数的进程:

链接分析:

脚本片段:

 case "$handle" in
          2)
            echo "The handle of the process :   "
            echo " " 
            handle | awk {print $3 "\n" $5 "\n" $7 "\n" $9 "\n" $11 "\n"} > temp      
            for i in `cat temp`
            do 
               ps -ef | grep $i | awk {print "{" $2 "}" ":" "{" $8 "}" ":" "{" $15 "}"} | grep $i             
            done
            rm -rf temp
            echo "等待5秒后,自动调整上一页。退出请按ctrl+c:"       
            sleep 5
            ;;
           1)
            echo "analysis"
            echo " "                   
            if [ $closewait -ge "20" ]
            then
                echo "CLOSE_WAIT:$closewait" 
                echo "长时间存在大量的CLOSE_WAIT没有被释放,会导致系统响应能力变慢,建议修改Linux内核参数http://cnblogs.com/javame"
            fi

脚本下载:

http://download.csdn.net/detail/yiyu1/7369159