Hi folks,
As I continue my self-torture [ >:) ], I've come on an interesting issue.
I now have a script that uses top on a Solaris box to gather performance data into a file for use in tracking over all performance.
And it even works 99.99% of the time.
But it glitches eventually and leaves a process still running and burning cpu cycles.
The unix admin who has been "helping me" just smiled as if he expected that and said I should use utilities which are native to Solaris.
Well, what I need from top are:
- the load averages
- the CPU Idle state data
- and the memory
from the displayed results below:
last pid: 25033; load avg: 0.11, 0.77, 0.59; up 21+07:05:28 16:25:24
104 processes: 103 sleeping, 1 on cpu
CPU states: 96.6% idle, 1.5% user, 2.0% kernel, 0.0% iowait, 0.0% swap
Kernel: 1181 ctxsw, 28 trap, 1072 intr, 1549 syscall, 26 flt
Memory: 10G phys mem, 4408M free mem, 9083M total swap, 9083M free swap
Now I can get the load averages easy with:
# prstat 1 1 | grep load | awk '{print $8, $9, $10}'
Sadly, prstat only gives most of it's data 'per process' where I need amalgamated data for the entire box.(as top gives)
When I investigated getting the CPU and memory data from vmstat, I could find no method of getting the values for "iowait" or "swap". In my investigations, the man page says there should also be "wa" value which I do not get form my vmstat as shown:
# vmstat 1 1
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr s0 s1 s3 -- in sy cs us sy id
3 0 0 11893120 5017848 7 46 1 0 0 0 0 0 2 -0 0 934 1029 1080 16 1 82
As for memory, the only values I see in vmstat are Swap and Free. Nothing about Physical memory, free or otherwise.
I investigated using sar, but our customer has it disabled and does not wish to enable it.
I am looking into my options, which are broadening as I look at things like "kstat", which i do not know how to use, and mpstat (using the -a flag). But this also does not get me a complete set of the data that top does.
On the basis that this is just a box following instructions, I am assuming there is another way to get what top does from a Solaris box and I am hoping that someone here can give me some direction in getting it?
I've even looked at the source for vmstat(vmstat.c) in order to see if I can figure out what it does[and no, I do not prog in c at all] and that led me to a bunch of ".h" files I'm exploring as I burn more and more work time.
Can anyone guide me to an answer for solaris?
Thanks and sorry for rambling.
Marc