6℃
FreeBSD下shell脚本监控swap
环境:FreeBSD 7.4
使用方法:
sh swap.sh 50
或
./swap.sh 50
//50(单位为M)为报警阈值,如不跟此参数则使用脚本中设置默认的100(单位为M)报警,由于是测试我们就用于小于当前测试系统负载的50M来测试
代码如下:
#!/bin/sh
VALUE=$1
VALUE=${VALUE:-"100"}
DATE=`/bin/date +%F\ %H:%M:%S`
IP=`/sbin/ifconfig | grep "inet" | grep -v "127.0.0.1" | grep -v "inet6" | awk '{print $2;}'`
SWAP=`pstat -T | sed 1d | sed 's/M\// /' | awk '{print $1}'`...
crontab, freebsd, swap阅读全文
4℃
FreeBSD下shell脚本监控磁盘使用率
环境:FreeBSD 7.4
使用方法:
sh disk.sh 80
或
./disk.sh 80
80为报警阈值,如不跟此参数则使用脚本中设置默认的90%报警
代码如下:
#!/bin/sh
VALUE=$1
VALUE=${VALUE:-"90"}
DATE=`/bin/date +%F\ %H:%M:%S`
IP=`/sbin/ifconfig | grep "inet" | grep -v "127.0.0.1" | grep -v "inet6" | awk '{print $2;}'`
LINE=`df -h | grep -v devfs | grep -v Filesystem | grep -v grep | awk '{print NR}' |xargs`
for i in $LINE
do
USE=`df -h ...
crontab, disk, freebsd, shell阅读全文