Operating System - HP-UX
1824819 Members
3739 Online
109674 Solutions
New Discussion юеВ

Memory and resource monitoring scripts

 
SOLVED
Go to solution

Memory and resource monitoring scripts

Hi,
We have Oracle Database sitting on HP 5470 running HP-UX 11i. I need to monitor the memory usage & cpu load of the system on regular basis for getting baseline statistics. I am a novice in term HP-UX, I have worked with Solaris and Linux extensively. Is there a tool like Linux's free or top by which I can easily get information about the usage of memory & cpu and can be used in scripts?

I already tried glance, top for cpu and memory and swapinfo -M for memory, but these show different Information. I am not sure which to trust.
Someone please help me on this.
12 REPLIES 12
A. Clay Stephenson
Acclaimed Contributor

Re: Memory and resource monitoring scripts

In HP-UX land, the tool of choice is Glance (or more accurately MeasureWare). You can use it to build your scripts as it has an excellent command-line interface. The old tools like top and sar are marginally useful at best.
If it ain't broke, I can fix that.

Re: Memory and resource monitoring scripts

Hi Clay,
Thanks for the prompt response. I am using a script which does this,

glance -m -j 2 -iterations 2 -f output_file > /dev/null

which emails me the content of the file, but the contents are huge, all I need is small amount of information. the CPU load and memory utilization, its gives me two cycles of their usage, all i need is point in time use. any advice on this.

Any help is much appreciated.

Suresh
Rajeev  Shukla
Honored Contributor

Re: Memory and resource monitoring scripts

Yes there are tools available on Linux, try www.mrtg.org you can monitor network traffic, disk io, memory cpu etc..
Other thing i would suggest is to write custom script to run from cron to collect the CPU load and memory usage by doing
uptime| cut -f2 -dl |cut -f2 -d: | cut -f1 -d, |awk '{print $1}'
swapinfo -t |grep ^total | awk '{print $5}' | cut -f1 -d%

Cheers
Rajeev

Re: Memory and resource monitoring scripts

Hi Rajeev,
Are you talking about Linux or HP-UX? Linux I can manage very well. HP-UX I have no experience on it.

Thanks,

Suresh

Re: Memory and resource monitoring scripts

Hi Rajeev,
I tried the commands you gave. They work but unfortunately I find it that the figure shown in swapinfo is weird and diff from the one shown in top and glance. Isn't there good tool which can tell me what exactly is happening?

thanks,

Suresh
Rajeev  Shukla
Honored Contributor

Re: Memory and resource monitoring scripts

MRTG is the program running on Linux with which you can monitor HP or Linux or infact any server or devices.

And the script i was talking about is for HPUX, you use swapinfo to see the memory usage and uptime to see the CPU load and by cutting the desired field you get the data.

Ermin Borovac
Honored Contributor

Re: Memory and resource monitoring scripts

You can use -adviser_only mode and specify metrics you'd like to monitor in adviser syntax file with -syntax option to glance.

$ cat temp
print "Global memory utilisation =", gbl_mem_util
print "Global priority queue =", gbl_pri_queue

$ glance -adviser_only -syntax temp -j 5 -iterations 1 > outfile 2>&1

Even if you specify one iteration you will get minimum of 2.

List of all metrics that can be used on HP-UX is in

/opt/perf/paperdocs/mwa/C/methp.txt

See /var/opt/perf/adviser.syntax for some more examples.
Nguyen Anh Tien
Honored Contributor
Solution

Re: Memory and resource monitoring scripts

I have some way
1. use ADB
#!/sbin/sh
Getdate='date +%Y%m%d'
echo "phys_mem_pages/D" | adb /stand/vmunix /dev/kmem>>/script/mon/mem.Getdate
echo "freemem/D" | adb /stand/vmunix /dev/kmem>>/script/mon/mem.Getdate
2. Use glance at adviser mode
- set crontab
0 * * * * sh /home/script/glance.sh
- contents of glance.sh
GetDate=`date +"%Y%m%d"`
LOG_NM=/home/sysopr1/script/glance/glance.$GetDate
/opt/perf/bin/glance -adviser_only -syntax /home/script/glance.cf -iterations 12 -j 300 >>$LOG_NM
- contents of glance.cf
PRINT " ", gbl_statdate, " ", gbl_stattime
PRINT "------------------------------------------------------------------------------------"
PRINT "System Memory: ", gbl_mem_sys
PRINT "Buffer Cache: ", gbl_mem_cache
PRINT "User Memory: ", gbl_mem_user
PRINT "Free Memory: ", gbl_mem_free
PRINT "-------------------------------"
PRINT "Total Physical Memory: ", gbl_mem_phys
PRINT ""
PRINT "===================================================================================="
PRINT "Process Name PID RSS VSS SHMEM Region RSS SHMEM Region VSS"
PRINT "===================================================================================="
PROCESS LOOP
{
flag="off"
PROC_REGION LOOP
{
IF (proc_region_type == "SHMEM") THEN
flag="on"
}
IF (flag == "on") THEN
{
PRINT proc_proc_name, proc_proc_id, proc_mem_res, proc_mem_virt
PROC_REGION LOOP
{
IF (proc_region_type == "SHMEM") THEN
PRINT " ", proc_region_res, " ",
proc_region_virt
}
PRINT "------------------------------------------------------------------------------------"
}
}
HP is simple
Chuck Ciesinski
Honored Contributor

Re: Memory and resource monitoring scripts

Sureshbabu,

Yes, in HP-UX there is a top command. It doesn't, in my opinion provide a whole lot about memory usage. Glance, which has a cousin Glance/iX in MPE, does do a fairly good job. At a former employer, we used MetaView from Lund Performance Solutions as an independent verifier of top. We were quite happy with MetaView as it has some really cool extra stuff for performance alerts.

HTH,

Chuck Ciesinski

Ps www.lund.com is the website for looking at the Lund tools.
"Show me the $$$$$"
Geoff Wild
Honored Contributor

Re: Memory and resource monitoring scripts

Here's a c program (just compile it) called memdetail:

# memdetail
Memory Stat total used avail %used
physical 10080.0 7666.2 2413.8 76%
active virtual 6968.7 1014.2 5954.6 15%
active real 5073.5 578.1 4495.4 11%
memory swap 7707.8 1714.0 5993.8 22%
device swap 28080.0 6669.1 21410.9 24%


Also - if you have Measurware - you can extract data like so:

Root Cron:

55 23 * * 1-5 [ -d /oracle/PR/920_64 ] && /opt/perf/bin/extract -xp -r /home/gwild/zgbltemplate -g -b today 7:00 -e today 18:00 -f stdout | /bin/mailx -s 'svr003 performance report' gwild >/dev/null 2>&1


# cat /home/gwild/zgbltemplate
REPORT "MWA Export on !SYSTEM_ID"
FORMAT ASCII
HEADINGS ON
SEPARATOR="|"
SUMMARY=60
MISSING=0
DATA TYPE GLOBAL
YEAR
DATE
TIME
GBL_CPU_TOTAL_UTIL
GBL_MEM_UTIL
GBL_SWAP_SPACE_UTIL
GBL_MEM_CACHE_HIT_PCT
GBL_DISK_UTIL_PEAK
GBL_FS_SPACE_UTIL_PEAK
GBL_MEM_PAGEOUT_RATE
GBL_MEM_SWAPOUT_RATE
GBL_MEM_QUEUE


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.

Re: Memory and resource monitoring scripts

Hi Guys,
Thanks a lot for all the help I got for this issue. I got a lot of data and found a lot issues in my HP-UX installation.

regards,
Suresh

Re: Memory and resource monitoring scripts

Hi Guys,
I am closing this thread, got a lot of useful information.

thanks
Suresh