Solved

Creating a log file of HPUX Memory Usuage

Posted on 2010-11-25
13
1,616 Views
Last Modified: 2012-05-10
Hello

We have recently introduced a 'web' version of an application which has been running for some time on an HPUX server.

It seems the web version is much more RAM intensive than the character version & users are complaining the application is running too slowly.

I can monitor memory useage in 'real time' using GlancePlus - it has been suggested that 'top' is not reliable for memory monitoring, but is it possible to write a file of what the memory useage is over a period of time? E.g. memory used/available/page file useage checked (for instance) every 15mins so we can get an overview of RAM over a period of time?

Thanks in advance for any help!
0
Comment
Question by:_Sparky
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 20

Expert Comment

by:flow01
ID: 34213786
we used 2 options for gathering the data but both use the 'top'-command

option 1 : scheduling a unix-script in crontab with a certain interval

script-content:
webloadfile=/tmp.new/webloadlist_`hostname`
top -d1 -n1 -f $webloadfile  # top
echo `ps -ef | grep -c frmweb` runform >> $webloadfile  # nr of oracle forms sessions
echo `ps -ef | grep -c oracleORA` sessies >> $webloadfile # nr of oracle database-sessions

option 2 : use a looping unix-script

script_content:
let "i1 = 0"
until test $i1 -gt 1000 # more then 3 days
do
  let "i1 = i1 + 1"
  sleep 300 # wait 5 minutes
  top -d1 -n1 > /tmp.new/top
  cat /tmp.new/leeg /tmp.new/top >> /tmp.new/top_verloop
  date
done


we prefer option 1 because if something in the script went wrong  the datagathering continues when the problem is solved

Filtering the desired output from the resulting file is another problem : we used an oracle pl/sql script to read the file and select the data from it
0
 
LVL 20

Expert Comment

by:flow01
ID: 34213801
Does your application involve  oracle forms ?  
0
 
LVL 62

Expert Comment

by:gheist
ID: 34214641
you can get memory usage and system load and disk usage from snmp....
nagios is very good, mrtg works with tweaking, and HP sells best for HP-UX - OpenView
0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

Author Comment

by:_Sparky
ID: 34215962
Hi,

The application is Progress (not Oracle) - We're still running the 'character' version but also now the web version (via webspeed brokers)

It seems the avaiable RAM has dropped dramatically since users have started logging in to the webspeed brokers & there is a noticable difference in general performance.  From sitting & 'watching' GPM it does look as though the server's paging but I need to be able to 'proove' that without having to invite other people to sit & watch GPM with me!

I took a look at the man page for snmp (snmpdm) but I have to be honest - it didn't make much much sense!  There seem to be all sorts of 'versions' of snmp from 3rd party vendors which is it that you suggest?

Thanks!
0
 
LVL 62

Expert Comment

by:gheist
ID: 34216892
snmp daemon only publishes the information.
you need some tool to collect it after.
0
 
LVL 20

Expert Comment

by:tfewster
ID: 34229989
`sar` (System Activity Reporter/Recorder) isn't as accurate* as Glance, but takes a snapshot of all system usage at user-defined times and logs it for later review so, if you wanted to see what I/O activity was taking place when memory usage jumped, you can analyse/graph it later.

Look at the man page for `sa1`for suggested cron setup; You could set it to log every minute during "peak times", e.g. when staff log in, then less frequently during the day.

Make sure you have plenty of space in /var!

* Like `top`, `sar` doesn't have the kernel hooks that Glance has, so can't be as precise, but gives a good indicator as to where to investigate further
0
 

Author Comment

by:_Sparky
ID: 34230607
Hi

This looks like the 'kind' of thing I'm looking for but will sa1 give me memory stats?  Also.....  How do I 'read' the file(s) that it produces?
0
 
LVL 20

Expert Comment

by:tfewster
ID: 34238280
Oops - `sar` doesn't show memory info. `vmstat` does that, but it doesn't log. Might as well stick with the terminal version of Glance:

glance -m -j 900  -f /tmp/glance_memory.out    # -m being "memory"

This starts the terminal version onscreen but logs the output for later review. I don't have access to an HP-UX system at the moment, so I'm not sure about the output format or if it could be graphed.
0
 

Author Comment

by:_Sparky
ID: 34238555
The glance command you gave above does give exactly the info I'm looking for....

But the format's exactly what you see on the screen and just repeated for each refresh interval so I don't think I'd be able to use it later - also, I assume you'd need to leave a telnet (or similar) connection running 'on screen'

Is there anyway I can get that information, just written to a file that could be used later?
0
 
LVL 20

Expert Comment

by:tfewster
ID: 34238797
Yes, it does just copy the screen display to a file, and you have to quit glance manually. HP sell MeasureWare/Perfview for the purpose of regular monitoring.

I'd use awk to extract the key info I wanted from the file (e.g. timestamp and the summary stats) so they could be displayed/graphed. If I recall correctly, the output contains formatting characters so `grep` isn't much use.  If you want to attach an output file with a few iterations and a specification of exactly which fields to extract, I'll have a go at it.
0
 

Author Comment

by:_Sparky
ID: 34247247
I've attached a copy of the .out file

I changed the interval to 30secs & ran it for a couple of mins just to get a few 'pages' included.

All I really need from the file are the four fields at the top of the page - memory util% disk% cpu% & swap%

Thanks
glance-memory.out.txt
0
 
LVL 20

Accepted Solution

by:
tfewster earned 500 total points
ID: 34263271
A quick and dirty:
sed -e 's/%//g' glance-memory.out.txt |
awk 'BEGIN {print "Timestamp,CPU,Disk,Mem,Swap"}
$1 ~ /B3692A/ {printf $4; printf ","}
$1 ~ /CPU|Disk|Mem/ {printf $5;printf ","}
$1 ~ /Swap/ {print $5}' > glance-extract.csv


gives a file suitable for import into Excel for graphing:
Timestamp,CPU,Disk,Mem,Swap
13:10:32,24,96,72,52
13:11:02,18,95,71,51
13:11:32,13,100,72,51

Of course, if that's an example from the server in question, your problem is disk I/O, not memory!
0
 

Author Closing Comment

by:_Sparky
ID: 34266560
Thanks for the help, that now gives me exactly what I need!

(I know about the disk I/O problem on that server - 1 problem at a time!)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question