Linux下针对服务器网卡流量和磁盘的监控脚本
1)实时监控网卡流量的通用脚本: [root@ceph-node1 ~]# cat /root/net_monit.sh #!/bin/bash PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export PATH function traffic_monitor { OS_NAME=$(sed -n '1p' /etc/issue) eth=$1 if [ ! -d /sys/class/net/$eth ];then echo -e "Network-Interface Not Found" echo -e "You system have network-interface:\n`ls /sys/class/net`" exit 5 fi while [ "1" ] do STATUS="fine" RXpre=$(cat /proc/net/dev | grep $eth | tr : " " | awk '{print $2}') TXpre=$(cat /proc/net/dev | grep $eth | tr : " " | awk '{print $10}') sleep 1 RXnext=$(cat /proc/net/dev | grep $eth | tr : " " |