Skip to main content

Posts

Showing posts from February, 2016

OEM chart on CPU utilization

We are using OEM 12C, it reports spike of CPU utilization of a server, but vmstat result does not. According to MOS doc, OEM use kstat to calculate CPU usage. How To Calculate CPU Usage on Solaris (Doc ID 1910409.1) And this link has some info about kstat on Solaris: https://blogs.oracle.com/tpenta/entry/how_solaris_calculates_user_system So I deleveloped the following shell script to verify the result: while true; do date >> kstat.dropit kstat -n sys -s 'cpu_nsec*'|awk 'BEGIN {idletotal=0;usertotal=0;systotal=0;total=0} {if ($1~/cpu_nsec_idle/) {idletotal=idletotal+$2;} else if ($1~/cpu_nsec_user/) {usertotal=usertotal+$2;} else if ($1~/cpu_nsec_kernel/) {systotal=systotal+$2;}} END {total=idletotal+usertotal+systotal; userpercent=usertotal*100/total;syspercent=systotal*100/total;idlepercent=idletotal*100/total; print "total="total,"idletotal="idletotal,"usertotal="usertotal,"systotal="systotal,"us