ディスクの容量を通知するメモ
#!/bin/sh #variable declare
val_warning=30 #warning value [%]
val_error=20 #error value [%]
val_panic=10 #panic value [%]
mailto="hoge@hoge.jp"
outfile=/tmp/df/dflog.log #output destination
#dfval=`df -k |awk ‘'{print $5}’|tail -1|sed s/%//`
dfval=`df -k |awk '{print $4}'|tail -3|head -n 1|sed s/%//`
if [ $dfval -lt $val_panic ]; then
echo 'Alert:disk use warning! use' = $dfval >> $outfile
echo 'Alert:disk use warning!use disk='$dfval'%'| /bin/mail $mailtoelse
if [ $dfval -lt $val_error ]; then
echo 'Alert:disk use warning! use' = $dfval >> $outfile
echo 'Alert:disk use warning!use disk='$dfval'%'| /bin/mail $mailtoelse
if [ $dfval -lt $val_warning ]; then
echo 'Alert:disk use warning! use' = $dfval >> $outfile
echo 'Alert:disk use warning!use disk='$dfval'%'| /bin/mail $mailtofi
fi
fi
■参考URL
バンブーウエイブブログ » Blog Archive » diskボリュームの空き監視
http://www.bamboowave.co.jp/blog/archives/10