Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

script to monitor swap memory, physical memory and cpu usage

 
SOLVED
Go to solution
Highlighted
Ah Young
Advisor

script to monitor swap memory, physical memory and cpu usage

hello,

I am trying to write a script which will monitor
the swap memory, physical memory and cpu usage of the server.
As for cpu usage, i will be using sar 3 3 and grep for the %idle.
But i am a little confuse in checking the swap memory and physical memory, as I realise that vmstat and glance is not giving the same output on the same server. beside this, which field should i be looking at.

Can any one kindly elaborate?
6 REPLIES 6
Highlighted
Victor Fridyev
Honored Contributor
Solution

Re: script to monitor swap memory, physical memory and cpu usage

Hi,

Try this one as an example. I run this script from crontab each 15 minutes.

Entities are not to be multiplied beyond necessity - RTFM
Highlighted
Ah Young
Advisor

Re: script to monitor swap memory, physical memory and cpu usage

thanks. the script is very useful. So right now, there is the outputs from the script. So what do i check for? Below is my personal view, correct me if i am wrong.
============================
output of swapinfo -tam
check for PCT used under memory for physical memory used

check for PCT used under dev for swap memory used
=============================

But as for the below output, what shall i look for?

00:45:46 text-sz ov proc-sz ov inod-sz ov file-sz ov
00:45:51 N/A N/A 75/1708 0 1552/4000 0 293/4058 0
=============================

Lastly, which is more accurate? glance or swapinfo? they seem to show different values when I run them.



Highlighted
Sung Oh
Respected Contributor

Re: script to monitor swap memory, physical memory and cpu usage

Hello,

swapinfo vs. glance
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=1005735
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=947347

For more information about memory management, check out the Memory Management Whitepaper in
/usr/share/doc/mem_mgt.txt

Regards,
Sung
Highlighted
Victor Fridyev
Honored Contributor

Re: script to monitor swap memory, physical memory and cpu usage

Hi,

First of all, you don't need to run all tests. If you run
#> remon -h
you see all parameters.
I run the script with -l parameter and, depending on the computer, I use different parameters, but almost always I look for swap.
I don't understand top output in the part of memory usage, so I prefer to look on swapinfo output.

Output of
00:45:46 text-sz ov proc-sz ov inod-sz ov file-sz ov
00:45:51 N/A N/A 75/1708 0 1552/4000 0 293/4058 0
says me whether kernel is built correctly and does not limit users with number of files etc.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Highlighted
Ah Young
Advisor

Re: script to monitor swap memory, physical memory and cpu usage

thanks for all the info. i will work on that.
Highlighted
Darrel Louis
Honored Contributor

Re: script to monitor swap memory, physical memory and cpu usage

Hi,

Check the following aswell:

ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/cronscripts/swapspace.ksh

Darrel