AIX CPU performance script ?

I want to write a shell script which will print AIX
CPU utilization
memory utilization

every 5 mins redirect to file. How do i do it? Please advise.
Which commands I should use?

Please do not make the font any smaller as it is already, thanks.

Check root's crontab if there is already an entry for sa1 and sa2. If there is, you will find something in /var/adm/sa. If not, read up about those 2 tools (man page or IBM Info Center for example) and put entries into root's crontab accordingly.

nmon is also very useful to setup monitoring.

1 Like

Thanks for the reply.

I added below entries in the cron

0 8-17 * * 1-5 /usr/lib/sa/sa1 1200 3 &
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 3600 -ubcwyaqvm &

But not found any output in /usr/adm/sa folder. So not sure if it is working.
Can I use below commands? Will that give accurate result ? Please advise

1.CPU utilization

iostat 
This command will give 
avg-cpu: % user % sys % idle % iowait physc % entc
I will add  CPU utilized as   % user + % sys
  1. Memory
svmon -G -O unit=GB

will consider inuse memory.

mnon - Not sure on how to redirect only CPU utilization & memory to file.

Are you sure you know what you want to measure at all?

"CPU utilization" and "memory utilization" is about as significant as the football results plus the lottery numbers of last week - summed up to a single number. You need the details and you need to define what you want to know before you even start to monitor. Otherwise you only get a bunch of meaningless numbers.

There is no such thing as a single number to describe any of the above, like there is no single number to describe the weather. There is temperature, air pressure, humidity, wind velocity, etc., but if you add all that up and arrive at "3156" would you know from this number what the weather is like? Perhaps not.

For CPU utilization, depending on what you want to know, the numbers of interest might be: the % of the time the CPU spends working on system calls, user programs, experiencing I/O-wait or idle times, further the percentage of "entitled capacity consumed" (the number of processor resources available to the LPAR versus the number of used real processor time) and maybe some numbers of minor significance too.

For memory utilization this might be: swap file utilization, size of computational memory, number of revolutions of the clock hand, number of pages scanned, file cache hit/miss ratio, size of file cache, some I/O-related numbers in "vmstat -v" and perhaps some other numbers, depending on what your system does and what is likely to be a bottleneck.

Btw.:

This is probably because you used cron to start background processes. They are probably still running. Remove the trailing "&" and redirect any possible output.

I hope this helps.

bakunin