HPunix CPU 內存 磁盤等利用率 輸出成報表

 

      HP unix 沒有像Aix 有nmon,但HPunix 有glance,但比起 nmon 易用性就差一些了,但glance 支持adviser模式,
所以此次利用glance的adviser模式,把監控的信息輸出到文本,留下記號,方便大家使用;

1 . adviser 配置文件
# -------------------------------------------------------------
# file name "total_system_perf"
#
#This adviser script prints the global cpu/disk/mem/swap utilization and also
# the network subsystem wait percent for the interval. Think of it as the
# glance global bars plus a network indicator.
# Don't change file name
#

firsttime=firsttime
if firsttime == 0 then
{
  print ""
  firsttime=1
  print "Date_Time              Interval  CPU%     DISK%     MEM%     SWAP%  NetworkWait %"
  print "---------------------------------------------------------------------------------"
}
print GBL_STATDATE,"_",GBL_STATTIME," ",GBL_INTERVAL,"     ",GBL_CPU_TOTAL_UTIL,"   ",GBL_DISK_UTIL_PEAK,"   ",GBL_MEM_UTIL,"   ",GBL_SWAP_SPACE_UTIL," ",GBL_NETWORK_SUBSYSTEM_WAIT_PCT

 

 

2. 啓動監控文件
# ---------------------------------------------------------------
# file name "start_monit.sh"
#
# 功能: 利用hp unix 的glance 的 adviser 選項,輸出到文本
#
# 輸出文件名:2011-07-08_22-26-23.csv

file_name=`date "+DATE: %Y-%m-%d_%H-%M-%S"|awk '{print $2}'`

nohup glance -adviser_only -syntax ./total_system_perf -j 3 >./${file_name}.csv &


3.停止監控
# ---------------------------------------------------------------
# file name "kill_glance_script_monit.sh"
#
# function:
#     1.kill the glance_adviser_monitor process
#     2.format the log to csv;
#

ps -ef | grep adviser_only | grep -v grep| awk '{print $2}' | xargs kill -9


find ./ -name "*.csv" |xargs perl -pi -e 's/ +/,/g'

bash


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章