分类:
2007-04-24 15:54:53
注:本文是由韩老大提供的
用Glance提取Memory使用率数据的命令:
echo 'print gbl_stattime, " Memory Usage=", GBL_MEM_UTIL' >temp
glance -adviser_only -syntax ./temp -j 5 > /tmp/*/* &
过程举例:
1.生成shell脚本
#vi /tmp/hanlong/1.sh
2.把一下内容拷贝到1.sh中
echo 'print gbl_stattime, " Memory Usage=", GBL_MEM_UTIL' >temp
glance -adviser_only -syntax ./temp -j 5 > /tmp/hanlong/1.log &
3.赋予权限
#chmod 777 /tmp/hanlong/1.sh
4.执行脚本
#sh /tmp/hanlong/1.sh
5.查看记录
#more /tmp/hanlong/1.log
15:17:21 Memory Usage= 93.8
15:17:26 Memory Usage= 93.8
15:17:31 Memory Usage= 93.8
15:17:36 Memory Usage= 93.8
15:17:41 Memory Usage= 93.8
15:17:46 Memory Usage= 93.8
注意:
以上的内容需要根据你的实际情况进行修改,如目录、文件名。
还要注意在实际应用中考虑定期清空文件,以免生成文件过大。
GBL_MEM_UTIL解释
The percentage of physical memory in use during the interval.
This includes system memory(occupied by the kernel),buffer cache and user memory