Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1793603
  • 博文数量: 293
  • 博客积分: 10127
  • 博客等级: 上将
  • 技术积分: 3029
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-12 19:05
文章分类

全部博文(293)

文章存档

2011年(11)

2010年(282)

我的朋友

分类: LINUX

2010-11-19 18:15:20

脚本check_host.sh内容如下(每分钟统计一次):
------------------------------------------------------------------------------------------------------------------------
#!/bin/bash

# check_host.sh
# 0 * * * * /u01/app/oracle/custom/oracle/bin/check_host.sh

DAT="`date +%Y%m%d`"
HOUR="`date +%H`"
DIR="/u01/app/oracle/dblog/host_${DAT}/${HOUR}"
DELAY=60
COUNT=60

# whether the responsible directory exist
if ! test -d ${DIR}
then
        /bin/mkdir -p ${DIR}
fi

# general check
export TERM=linux
/usr/bin/top -b -d ${DELAY} -n ${COUNT} > ${DIR}/top_${DAT}.log 2>&1 &

# cpu check
/usr/bin/sar -u ${DELAY} ${COUNT} > ${DIR}/cpu_${DAT}.log 2>&1 &
#/usr/bin/mpstat -P 0 ${DELAY} ${COUNT} > ${DIR}/cpu_0_${DAT}.log 2>&1 &
#/usr/bin/mpstat -P 1 ${DELAY} ${COUNT} > ${DIR}/cpu_1_${DAT}.log 2>&1 &

# memory check
/usr/bin/vmstat ${DELAY} ${COUNT} > ${DIR}/vmstat_${DAT}.log 2>&1 &

# I/O check
/usr/bin/iostat ${DELAY} ${COUNT} > ${DIR}/iostat_${DAT}.log 2>&1 &

# network check
/usr/bin/sar -n DEV ${DELAY} ${COUNT} > ${DIR}/net_${DAT}.log 2>&1 &
#/usr/bin/sar -n EDEV ${DELAY} ${COUNT} > ${DIR}/net_edev_${DAT}.log 2>&1 &
------------------------------------------------------------------------------------------------------------------------

放在crontab里每小时自动执行:
0 * * * * /u01/app/oracle/custom/oracle/bin/check_host.sh

这样会在/u01/app/oracle/dblog/host_yyyymmdd/hh目录下生成各小时cpu、内存、网络,IO的统计数据。

如果某个时间段产生问题了,就可以去看对应的日志信息,看看当时的主机性能如何。

--End--
阅读(883) | 评论(1) | 转发(0) |
0

上一篇:AIX VI编辑器

下一篇:ibm tsm

给主人留下些什么吧!~~

chinaunix网友2010-11-22 17:17:28

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com