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.モニタファイルを起動する#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------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.監視を停止#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------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