- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need to Calculate used memory in KB for monitoring...
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
Discussions
Discussions
Forums
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
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
тАО06-30-2009 02:23 AM
тАО06-30-2009 02:23 AM
We're using a script where we need to extract the exact amount of memory in KB the system is using at that moment.
The closest we've been is with the vmstat command where we can obtain the number of pages used, which are 4KB each, then we multiply this amount and get the total amount of memory used, we think.. We're not quite sure about this as the amount given is sometimes above the total RAM of our Server. Maybe because it does use virtual pages from disc as well?
Is there any other command where we can obtain this information easily?
Commands like glance, top, etc are not useful as we need to obtain the information from a script.
Any idea?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 02:38 AM
тАО06-30-2009 02:38 AM
Re: Need to Calculate used memory in KB for monitoring script
http://www.hpux.ws/?p=8
That script shows top memory users. It is sorted.
it accepts a command line parameter to tell how many processes to monitor.
So it could be used to get snapshots of all resident memory on the system and do calculations as you desire.
If you take it and modify it, I only ask that you return the results so I can post the modification to the blog.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 03:02 AM
тАО06-30-2009 03:02 AM
Re: Need to Calculate used memory in KB for monitoring script
Although your response is very useful I am afraid it was not exactly what we are looking for.
The thing is we are using nagios for our servers monitoring. Nagios needs to request the information to our server sporadically and we don't want to run any script on the server itself. Our desire is to execute a command remotely and obtain the total amount of memory used at that moment for that server. We are using now vmstat and think we got the total amount by issuing vmstat and then multiply it by 4 (4KB each page of memory), but we want to know if this is the total amount of RAM and virtual memory used by the system. Are we wrong with this statement?
Thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 03:41 AM
тАО06-30-2009 03:41 AM
Re: Need to Calculate used memory in KB for monitoring script
Instead of assuming the the pagesize is always 4K (it isn't necessarily) you should query it and use its value as your multiplier:
# getconf PAGE_SIZE
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 03:51 AM
тАО06-30-2009 03:51 AM
Re: Need to Calculate used memory in KB for monitoring script
Yes, the result after issuing the getconf command is:
#getconf PAGE_SIZE
4096
So, assuming this we can obtain the exact amount of memory the system is utilizing with the vmstat command. Is there a way to obtain only the RAM Mem usage at a given moment?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 03:54 AM
тАО06-30-2009 03:54 AM
Re: Need to Calculate used memory in KB for monitoring script
Page size is 4K
To calculate memory use in kb, divide page figures from vmstat or other page utilities by 4.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 03:55 AM
тАО06-30-2009 03:55 AM
Solutionvmstat will not show the physical memory usage. It reports the virtual memory usage.
If you want to know the physical memory usage then you may consider the HP tools like "kmeminfo".
kmeminfo will give output like this..
----------------------------------------------------------------------
Physical memory usage summary (in page/byte/percent):
Warning: Bad super pointer deref mem_class_t-->priv_data
Warning: Bad super pointer deref u_mem_class_priv_t-->mrg_file_data
Physical memory = 524288 2.0g 100%
Free memory = 299134 1.1g 57%
User processes = 40564 158.5m 8% details with -user
System = 181778 710.1m 35%
You can grep only the "Free memory"
Hope this helps
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 04:03 AM
тАО06-30-2009 04:03 AM
Re: Need to Calculate used memory in KB for monitoring script
Hi Ganesan, that is exactly what I want but unfortunately kmeminfo was not found in our systems. We use V11.23. An easy way to get this command to function?? :) We are getting close with this one.
p.s: want to thank you all for your quick support with this thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 04:13 AM
тАО06-30-2009 04:13 AM
Re: Need to Calculate used memory in KB for monitoring script
vmstat reports virtual pages, but the free pages is physical. You can use it _if_ you know the total RAM in the first place (there are various tricks to get this such as adb, grepping the syslog for the boot up message, etc.). The best way to get both though is to write you own little pstat based program to report just what you want however you find it most useful for your script.
Attaching a sample -- you'll likely want to just comment out/remove all you're not interested in (I expect the "physical" output is all you want).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2009 04:21 AM
тАО06-30-2009 04:21 AM
Re: Need to Calculate used memory in KB for monitoring script
kmeminfo in not an internal command. If you have contract you can get it from HP.
Ganesh.