#
# 检查数据库状态和日志状态,参数为数据库空间阀值
#
count=`onstat -l | grep -c "On-Line" `
if [ $count -eq 0 ]
then
echo "数据库状态不为ONLINE"
exit 129
fi
count=`onstat -l | grep "U\-\-" | grep -v "U\-B" |wc -l`
if [ $count -gt 2 ]
then
echo "日志备份错误"
exit 130
fi
dbaccess > $TMPDIR/informix.txt 2>&1 - - << !
database sysmaster;
select distinct name,sum(nfree)/sum(chksize)*100,"%"
from syschunks,sysdbspaces
where syschunks.dbsnum=sysdbspaces.dbsnum
group by name;
close database;
!
rm $TMPDIR/moninformix >/dev/null 2>&1
cat $TMPDIR/informix.txt | grep "%" | awk '{
if ( $2 < limit )
{
printf "数据库空间低 DBS[%s] 空闲率[%d%%]\n", $1,$2
system("> $TMPDIR/moninformix")
}
}' limit=$1
if [ -f $TMPDIR/moninformix ]
then
exit 1
else
echo "Informix正常"
exit 0
fi
阅读(1367) | 评论(0) | 转发(0) |