Solved

Creating a log file of HPUX Memory Usuage

Posted on 2010-11-25
13
1,597 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 61

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
 

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 61

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now