- 论坛徽章:
- 0
|
看了一下文档,可以用glance的metrics解决
我写了两个脚本
第一个:
$ cat runstat.ksh
host=`hostname`
tag=`date \'+%Y%m%d\'`
BaseDir=`dirname $0`
mkdir -p ${BaseDir}/log
/opt/perf/bin/glance -adviser_only -nosort -iterations 10 -j 3 -syntax ${BaseDir}/proc_IO.ksh >>${BaseDir}/log/proc_disk$tag.log 2 >&1&
第二个:
$ cat proc_IO.ksh
IF GBL_DISK_UTIL_PEAK > 80 THEN{
highestIO = 10
process loop {
IF PROC_DISK_PHYS_IO_RATE > highestIO THEN{
highestpid = proc_proc_id
highestname = proc_proc_name
highestIO = PROC_DISK_PHYS_IO_RATE
}
}
print \"--- High PHYS IO rate = \",GBL_DISK_UTIL_PEAK, \" at \",
gbl_stattime, \" ---\"print \" Process with highest IO was pid \", highestpid, \", name: \", highestname
print \" which had \", highestIO, \" physical IO of Proc\", \"utilization\"
}
运行runstat.ksh,得到的log是:
$ cat proc_disk20061031.log
--- High PHYS IO rate = 100.0 at 23:01:39 ---
Process with highest IO was pid 16554, name: extract
which had1494.5 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:01:42 ---
Process with highest IO was pid 16554, name: extract
which had2507.6 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:01:45 ---
Process with highest IO was pid 16554, name: extract
which had1041.0 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:01:48 ---
Process with highest IO was pid 8691, name: oracleSCCOAPRD
which had 446.3 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:01:51 ---
Process with highest IO was pid 8691, name: oracleSCCOAPRD
which had 442.4 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:01:54 ---
Process with highest IO was pid 8691, name: oracleSCCOAPRD
which had 496.3 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:01:57 ---
Process with highest IO was pid 8691, name: oracleSCCOAPRD
which had 431.6 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:02:00 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 915.1 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:02:03 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 368.9 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:02:06 ---
Process with highest IO was pid 8691, name: oracleSCCOAPRD
which had 453.6 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:03:01 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 254.2 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:03:04 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 469.6 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:03:07 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 412.3 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:03:10 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 451.0 physical IO of Procutilization
--- High PHYS IO rate = 100.0 at 23:03:13 ---
Process with highest IO was pid 5334, name: oracleMMSPRD
which had 410.6 physical IO of Procutilization |
|