- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Memory utilization of HP Unix server assign to a v...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2007 12:47 PM
10-15-2007 12:47 PM
Memory utilization of HP Unix server assign to a variable
I want to know how I can get the value of physical memory utilization in HP UNIX.
Even though I know many ways to get it, I am not able to call any of those methods from a script.
I want to know how I can get memory utilization value assigned to a variable from a script ???
Thanks in advance
Nair
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2007 07:31 PM
10-15-2007 07:31 PM
Re: Memory utilization of HP Unix server assign to a variable
echo $MEM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2007 09:07 PM
10-15-2007 09:07 PM
Re: Memory utilization of HP Unix server assign to a variable
you can also try:
echo phys_mem_pages/D | adb -k /stand/vmunix /dev/mem | tail -1 | awk '{printf("%.2f MB\n",$2*.004096)}'
or
mymem=$(echo phys_mem_pages/D | adb -k /stand/vmunix /dev/mem | tail -1 | awk '{printf("%.2f \n",$2*.004096)}')
e.g.
# mymem=$(echo phys_mem_pages/D | adb -k /stand/vmunix /dev/mem | tail -1 | awk '{printf("%.2f \n",$2*.004096)}')
# echo $mymem
7516.19
hope this helps too!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 03:27 AM
10-16-2007 03:27 AM
Re: Memory utilization of HP Unix server assign to a variable
To put the output of any command in a shell variable just use the old backticks are Awadhesh suggests, but the $() method Yogeeraj uses is now preferred.
Other example:
$ FREE=$(vmstat | awk '/[0..9]/ { print $5 / 256 }')
$ print $FREE
11721.5
[The division by 256 converts 4096 byte pages to megabytes (1024*1024 bytes) ]
When interested in memory usage, be sure to check out:
ftp://hprc.external.hp.com/memory.htm#Monitoring_Memory_Usage
Specifically, it suggests that the 'mem' line Awadhesh picks up is actually psuedo memory and not ready for immediate consumption/interpretation.
Awadhesh....
>> MEM=`swapinfo|grep mem|awk '{print $3}'`
echo $MEM
Lots of nits to pick... Sorry...
) swapinfo is not int he path for ordinary users
) why feed into grep, when awk can compare
) some joker sa might have named a swap device with the string 'mem' in there. Really should anchor searched as a habit.
It makes them safer and faster.
) The data returned is of debatable use.
suggested alternative (if useful at all!)
MEM=$(/usr/sbin/swapinfo| awk '/^mem/{print $3}')
Cheers!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 03:52 AM
10-16-2007 03:52 AM
Re: Memory utilization of HP Unix server assign to a variable
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 04:05 AM
10-16-2007 04:05 AM
Re: Memory utilization of HP Unix server assign to a variable
That's a big, SLOW, hammer you show!
But isn't that column $4, not $5 for the number?
btw... similar comments as I had for Awadhesh.
It's not going to make a difference here, but in general... why feed into different processes work which awk will happily do itself? Be explicit about some paths?
$ total=$( echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm | awk '/Total Configured/{print $4; exit}' )
$ print $total
16384
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 04:54 AM
10-16-2007 04:54 AM
Re: Memory utilization of HP Unix server assign to a variable
# total=$( echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm | awk '/Total Configured/{print $4; exit}' )
# echo $total
:
# total=$( echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm | awk '/Total Configured/{print $5; exit}' )
# echo $total
16384
The base output looks like:
# echo "selclass qualifier memory;info;wait;infolog" | cstm | grep 'Total Configured'
Total Configured Memory : 16384 MB
Total Configured Memory : 16384 MB
Rgds...Geoff
PS: The Hammers...The Hammers are the name of what English football team....What English football team?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 05:07 AM
10-16-2007 05:07 AM
Re: Memory utilization of HP Unix server assign to a variable
hexval=$(echo "phys_mem_pages/A" | adb /stand/vmunix /dev/kmem|tail +2|awk '{print $2}')
REAL_MEM=$(echo ${hexval}=D|adb)
mb=$(expr ${REAL_MEM} / 256)
echo $mb
16128
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 05:34 AM
10-16-2007 05:34 AM
Re: Memory utilization of HP Unix server assign to a variable
Looks like there is on yours.
I guess one would have to print $(NF-1) to catch both.
$ uname -a
HP-UX td194 B.11.31 U ia64 3426292962 unlimited-user license
:
Version D.01.00
Product Number B4708AA
:
Basic Memory Description
Module Type: MEMORY
Page Size: 4096 Bytes
Total Physical Memory: N/A
Total Configured Memory: 16384 MB
Total Deconfigured Memory: N/A
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2007 01:16 PM
10-16-2007 01:16 PM
Re: Memory utilization of HP Unix server assign to a variable
I was requiring Utilized memory,So I taken in this way
TOTAL=$( echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm | awk '/Total Configured/{print $5; exit}' )
FREE=$(vmstat | awk '/[0..9]/ { print $5 / 256 }')
((UTIL=TOTAL-FREE))
echo $UTIL
Thanks
Damu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2007 09:13 AM
10-25-2007 09:13 AM
Re: Memory utilization of HP Unix server assign to a variable
FREE=$(vmstat | awk '/[0..9]/ { print $5 / 256 }')
((UTIL=TOTAL-FREE))
echo $UTIL