Operating System - HP-UX
1833728 Members
2955 Online
110063 Solutions
New Discussion

Re: How to check memory utilization in script

 
Alexander Bakhmutsky
Occasional Advisor

How to check memory utilization in script

I'm trying to setup paging when server memory utilization reaches 90%. The only 2 ways of getting memory utilization I know is by using glance of top. Is there a way to get similar info through the command line?
9 REPLIES 9
Sundar_7
Honored Contributor

Re: How to check memory utilization in script

Hi,

echo "freemem/D" | adb -k /stand/vmunix /dev/kmem

Will give u the free memory in pages.

Thanks,

Sundar.
Learn What to do ,How to do and more importantly When to do ?
Alexander Bakhmutsky
Occasional Advisor

Re: How to check memory utilization in script

How can I get the page size?
Sundar_7
Honored Contributor

Re: How to check memory utilization in script


Page size is by default 4 KB.

# dmesg | grep "physical page size"
# grep "physical page size" /var/adm/syslog/syslog.log
Learn What to do ,How to do and more importantly When to do ?
Pete Randall
Outstanding Contributor

Re: How to check memory utilization in script

vmstat |grep -v r |awk ' { print $4, $5 } '

will give you the "avm" and "free" figures. You would then need to compare the two to see if you're getting close.


Pete


Pete
Pete Randall
Outstanding Contributor

Re: How to check memory utilization in script

Or you could use this:

vmstat |grep -v r |awk ' { print $9 } '

which would print the page outs. If that's greater than 0, you've got issues!


Pete


Pete
Alexander Bakhmutsky
Occasional Advisor

Re: How to check memory utilization in script

Thanks everybody.
Clay Jordan
Advisor

Re: How to check memory utilization in script

You can run glance from the command line in advisor mode using the syntax

`glance -adviser_only -syntax global_stats.syntax -j 5 -iterations 6 2>/dev/null`

where a syntax file would look like

PROCESS LOOP
{
print GBL_CPU_TOTAL_UTIL," ",GBL_CPU_USER_MODE_UTIL," ",GBL_CPU_SYS_MODE_UTIL
}

These metrics are for CPU, but you can choose other glance metrics as well. They would be found in
/opt/perf/paperdocs/mwa/C/metrics.pdf

Clay
hein coulier
Frequent Advisor

Re: How to check memory utilization in script

using "top -d1 -s1 -f /tmp/top", you can
save the output of the top command.
Stanimir
Trusted Contributor

Re: How to check memory utilization in script

Hi!
I'm attaching you a program.
Regards.