首页 > 系统服务 > 详细

linux监控脚本

时间:2015-04-07 19:20:04      阅读:259      评论:0      收藏:0      [点我收藏+]

1,网卡流量监控RateOfFlow.sh

#!/bin/bash
#
while true;
do
time=`date +%m"-"%d"-"%k":"%M`
day=`date +%m"-"%d`
rx_before=`ifconfig eth0|sed -n "7"p|awk {print $2}|cut -c7-`
tx_before=`ifconfig eth0|sed -n "7"p|awk {print $6}|cut -c7-`
sleep 2
rx_after=`ifconfig eth0|sed -n "7"p|awk {print $2}|cut -c7-`
tx_after=`ifconfig eth0|sed -n "7"p|awk {print $6}|cut -c7-`
rx_result=$[(rx_after - rx_before)/256]
tx_result=$[(tx_after - tx_before)/256]
echo $time Now_In_Speed:$rx_result kbps Now_Out_Speed:$tx_result kbps
sleep 2
done

2,个磁盘lv 空间

df -lh| sed -n ‘/\/$/p‘|awk ‘{print $5}‘|sed ‘s/%//‘

df -lh| sed -n ‘/\//p‘|awk ‘{print $5}‘|sed ‘s/%//‘

技术分享

df -lh | sed -n /\//p|awk {print $5}|sed s/%//

 

linux监控脚本

原文:http://www.cnblogs.com/ruiy/p/4398902.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!