Operating System - HP-UX
1827721 Members
2940 Online
109968 Solutions
New Discussion

Re: Script to to find CPU and memory utilization.

 
SOLVED
Go to solution
jeevarajkn
Frequent Advisor

Script to to find CPU and memory utilization.

Dear Guru's

Server-HP UX IA-11.23

Please help me to find a script to get CPU and memory usage of my server in every 1hr.

I just want to get the utilization value in every 1 Hr, no need to get the high utilization process.


Thanks in Advance!!!!

Jeevaraj Sivaraman
11 REPLIES 11
Stephan._1
Trusted Contributor

Re: Script to to find CPU and memory utilization.

Hi,
what about enabling sar?

http://docs.hp.com/en/B3921-90010/sar.1M.html
Share what you know, learn what you don't.
Michal Kapalka (mikap)
Honored Contributor

Re: Script to to find CPU and memory utilization.

hi,

you could use glance, or gpm (gui)

mikap
Vijaykumar_1
Valued Contributor

Re: Script to to find CPU and memory utilization.

hi Jeevraj,

If you have OVO monitoring installed, then you can use the following ..

$ /opt/OV/bin/ovcodautil -dumpds SCOPE | grep -i GBL_CPU_UTIL
Hakki Aydin Ucar
Honored Contributor

Re: Script to to find CPU and memory utilization.

# sar -u [interval] [iterations]
(example: sar -u 5 30)
OR

sar -Mu 5 100
(this will produce 100 data points 5 seconds apart.)

%idle This is the percentage of time that the CPU is not running processes.

%usr - user mode Many systems normally operate with 80% of the CPU time spent as user time, and 20% spent as system time.

%sys- system mode

%wio - idle with some process waiting for I/O
jeevarajkn
Frequent Advisor

Re: Script to to find CPU and memory utilization.

Dear Hakki,

Thanks. it will help me to get the CPU usage , can you help me to find out the swap memory usage , I want this on percentage like swapinfo output.

Reg
Jeevaraj Sivaraman
Prashantj
Valued Contributor
Solution

Re: Script to to find CPU and memory utilization.

Hi Jeevarajkn,

Please go thru that belwo script.

echo " *********** **************** " >> /tmp/swap.txt
echo "CUP and memory Utlization Report" >> /tmp/swap.txt
date >> /tmp/swap.txt
swapinfo -tam >> /tmp/swap.txt

Edit Crontab file with
* 1 * * * < Scrip Path >

Hope this will help you.

prashant
Good judgment comes from experience and experience comes from bad judgment.
Raj D.
Honored Contributor

Re: Script to to find CPU and memory utilization.

Jeevaraj,

Check this out : script : cpumme.sh to get cpu memory utilization over a time,

I have a latest script with swap,raw disk i/o, network usage details and ll upload soon.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1250075141947+28353475&threadId=1037077


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: Script to to find CPU and memory utilization.

Jeevaraj,

Check this out : script : cpumem.sh to get cpu memory utilization over a time,

I have a latest script with swap,raw disk i/o, network usage details and ll upload soon.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1250075141947+28353475&threadId=1037077


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Steven E. Protter
Exalted Contributor

Re: Script to to find CPU and memory utilization.

Shalom Jeevaraj,

Have you tried this:
http://www.hpux.ws/?p=6

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Hakki Aydin Ucar
Honored Contributor

Re: Script to to find CPU and memory utilization.

Use 'swapinfo -tm' to get a complete/total picture of swap usage. Pay particular attention to the total line as it indicates how much swap space has been actually reserved for swap. When this percentage gets near 100%, processes will not start up (unable to fork process) and new shared memory segments can not be created.
swapinfo -tm example and explanation :

Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 288 83 205 29% 0 - 1 /dev/vg00/lvol2
reserve - 141 -141
memory 102 41 61 40%
total 390 265 125 68% - 0 -

o dev line(s):
+ are the actual physical swap device(s)
o reserve line(s)
+ indicate how much of the swap device(s) has(have) been set aside for memory should it need to be swapped.
o memory line:
+ indicative of how much of pseudo-swap has been reserved
o total line:
+ the PCT USED value shown in the total line indicates how much swap space has been actually reserved for swap. When this percentage gets near 100%, processes will not start up (unable to fork process) and new shared memory segments can not be created.
jeevarajkn
Frequent Advisor

Re: Script to to find CPU and memory utilization.

Dear Guru's


Thanks fopr your repply.Iam closing this query.