Operating System - HP-UX
1751924 Members
4664 Online
108783 Solutions
New Discussion юеВ

Re: Script for monitoring the Utilization of CPU and Memory.

 
SOLVED
Go to solution
Narendra Uttekar
Regular Advisor

Script for monitoring the Utilization of CPU and Memory.

Hi,
I want to write a script to monitor the utilization of CPU and Physical Memory every 15 min for 24 hours so that later i can plot the graph for CPU and Memory utilization.And using internal HP-UX command i.e. sar,top and vmstat.

Thanks,
Narendra
4 REPLIES 4
Matti_Kurkela
Honored Contributor

Re: Script for monitoring the Utilization of CPU and Memory.

So you want to write a script. What is preventing you from doing just that?

Read the relevant man pages: use the commands "man sar", "man top" and "man vmstat" to find the options you may need.

Find the commands that would produce the information you need if you had to do it manually. Then write the commands into a text file, one per line. You now have the basics of your script right there!

Read "man sh-posix" if you need to learn about shell script syntax, shell built-in commands or general features of the standard Posix shell.

MK
MK
Arturo Galbiati
Esteemed Contributor

Re: Script for monitoring the Utilization of CPU and Memory.

Hi Narendra,
this is monitoring script that uses glance.

#!/usr/bin/sh
GlnCmd=/opt/perf/bin/glance
WrkDir=~gpsactv/CHECK/scripts
GlnSyn=$WrkDir/gln_syntax_file
GlnOpt="-j60 -adviser_only -nosort -iterations 2 -bootup -syntax $GlnSyn"
ResLog=$(date +%Y%m)-res-cop.log
# Create glance syntax file
cat<$GlnSyn
print "-- ",
gbl_statdate,
" ",
gbl_stattime,
" ",
gbl_cpu_total_util|3|0,
" ",
gbl_disk_util_peak|3|0,
" ",
gbl_mem_util|3|0,
" ",
gbl_swap_space_util|3|0
EOD
#echo -- MM/DD/YY HH:MM:SS CPU DSK MEM SWA
$GlnCmd $GlnOpt 2>/dev/null |tail +2 >>$WrkDir/../dat/$ResLog
#eof

HTH,
Art
V. Nyga
Honored Contributor

Re: Script for monitoring the Utilization of CPU and Memory.

Hi

Bill McNAMARA created two threads to collect usefull scripts of any sort:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=178514

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Viktor Balogh
Honored Contributor
Solution

Re: Script for monitoring the Utilization of CPU and Memory.

If you want shiny graphs you can use perfview. Khm, I wanted to say 'Performance Manager', as it is called by this summer. Here is a trial version:

https://h10078.www1.hp.com/cda/hpms/display/main/hpms_content.jsp?zn=bto&cp=1-11-15-28^1792_4000_100__

You don't need to write a script, with Performance Manager you can reach back to historical data:

"
HP Performance Manager Software is a web-based analysis and visualization tool that analyzes performance trends of applications, systems, and services. This software helps you manage your application performance by enabling you to proactively detect and isolate server bottlenecks. It provides a consistent set of cross-platform metrics for heterogeneous physical and virtual environments. And it enables you to examine server utilization in real time and historical performance trends. "
****
Unix operates with beer.