check_arp

检查arp表是否满

#!/bin/bash

LANG=C
test -e /bin/date && timestamp=`/bin/date +%s`
ARP=`which arp`
arp_num=$(wc -l /proc/net/arp|awk '{print $1}')

check_full=0
time0=$(dmesg |tail -n 1000|grep 'Neighbour table overflow'|tail -n1 |awk '{print $1}'|sed -r 's/[^0-9\.]//g')
time1=$(cat /proc/uptime |awk '{print $1}')
check_full=$(echo "$time1 $time0"|awk '{if(($1-$2)/3600<24){print 1 }else{print 0 }}')
if [ -z $time0 ];then
    check_full=0
fi
if [ $check_full -eq 1 ];then
    MSG="arp_cache_full"
else
    MSG="arp_cache_not_full"
fi
#If check_full=0 means arp_cache_not_full
#check_full
echo -e "$timestamp\tarp_cache_count=$arp_num check_full=$check_full msg=$MSG"
上一篇:SQL Server 表的管理_关于事务操作的详解(案例代码)


下一篇:laravel transaction : laravel 的事务是不支持eloquent的, 要用DB::的方式