- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Get HP Unix System Memory & CPU Usage
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
11-27-2007 07:37 PM
11-27-2007 07:37 PM
Get HP Unix System Memory & CPU Usage
I have read the messages posted in this forum regarding various methods to get system memory usage. I tried ps, vmstat, top, sar, glance etc. My requirement is to get the Unix system memory usage & cpu usage through a program (java or c). I am in the process of building a monitoring tool which will get the above details from an unix machine as and when required and store it in a database for future analyses.
In this context I found the code (c program) posted by Brian Bergstrand very useful. But I get compile errors if I try to compile the code in my HP Unix 11i machine. The error is pasted below:-
cc: "memdetail.c", line 29: error 1574: Unknown size for "sbuf".
cc: "memdetail.c", line 30: error 1574: Unknown size for "dbuf".
cc: "memdetail.c", line 31: error 1574: Unknown size for "vbuf".
cc: "memdetail.c", line 40: error 1594: The sizeof operator cannot be applied to types with unknown size.
and so on..............
I think the code needs to be altered to compile in this version of unix. Can someone please provide me the correct program or the binary file. The binary file (memdetail) that I downloaded from this forum gives "Memory fault(coredump)" error.
If there is any other way to get the unix system cpu and mem usage, please let me know. I have attached memdetail.c program for your reference.
Thanks in advance,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2007 09:03 PM
11-27-2007 09:03 PM
Re: Get HP Unix System Memory & CPU Usage
I believe you may want to try a gcc compiler on this code.
If its not able to be compiled, then you must either change the code or find another tool.
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
11-27-2007 09:35 PM
11-27-2007 09:35 PM
Re: Get HP Unix System Memory & CPU Usage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2007 09:44 PM
11-27-2007 09:44 PM
Re: Get HP Unix System Memory & CPU Usage
>SEP: I believe you may want to try a gcc compiler on this code.
The bundled C compiler also compiles it.
>Venkatesh: Does your system have the /usr/include/sys/pstat.h file?
That would give a different error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 01:53 AM
11-28-2007 01:53 AM
Re: Get HP Unix System Memory & CPU Usage
/usr/ccs/bin/cc
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 02:16 AM
11-28-2007 02:16 AM
Re: Get HP Unix System Memory & CPU Usage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 02:54 AM
11-28-2007 02:54 AM
Re: Get HP Unix System Memory & CPU Usage
please find the compiled binary attached.
parisc version
Regards,
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 11:30 AM
11-28-2007 11:30 AM
Re: Get HP Unix System Memory & CPU Usage
I am getting "Memory Fault(coredump)" if I try to execute your binary. I already got a binary from this forum but since it gave this coredump error I wanted to compile the program on my unix server (HP-UX B.11.11 U 9000/800) and check it out.
Dear Other members,
Thanks for all your reponses.
If I compile with -Ae option, actually nothing happens. I could neither see any binaries being created not I get any error. Please assist me to fix this issue.
Have anyone tried using "Runtime.getRuntime().exec" java function to call some unix utilities like top, glance etc. and get the cpu & memory usage of unix system? If so, please guide with me the code.
I am quite please with the response I am getting from this forum. I hope I will be able to fix my issue soon.
Regards,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 11:54 AM
11-28-2007 11:54 AM
Re: Get HP Unix System Memory & CPU Usage
Works fine for me. Perhaps attaching the corefile may help.
>If I compile with -Ae option, actually nothing happens.
Compile with the following and paste the result:
cc -v -Ae ...
system? If so, please guide with me the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 12:24 PM
11-28-2007 12:24 PM
Re: Get HP Unix System Memory & CPU Usage
Thanks for your quick response. Please find attached the output of "cc -v -Ae memdetail.c".
Thanks & Regards,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 12:41 PM
11-28-2007 12:41 PM
Re: Get HP Unix System Memory & CPU Usage
(It would have been better if you just had a text file or pasted into the text.)
Everything is working fine. You get no output because you don't have any errors/warnings.
You just need to execute a.out
>I could neither see any binaries being created
What were you looking for?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 01:16 PM
11-28-2007 01:16 PM
Re: Get HP Unix System Memory & CPU Usage
Sorry for not attaching the text file. Thanks for letting me know that everything is working fine.
a.out is giving the desired output in my case as well. Thanks much.
Actually, I was expecting that a binary file with the name "memdetail" will be created so that I can call it from a java program and get the memory info as and when required. Please let me know how can I create such a binary to be called by a java program.
Thanks & Regards,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 01:34 PM
11-28-2007 01:34 PM
Re: Get HP Unix System Memory & CPU Usage
I thought this was obvious so I didn't mention it:
$ cc -Ae memdetail.c -o memdetail
http://docs.hp.com/en/10946/options.htm#opt-o
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 01:52 PM
11-28-2007 01:52 PM
Re: Get HP Unix System Memory & CPU Usage
Thanks again for your prompt response. I am new to hp environment. I could now successfully create the binary and it works fine. I have assigned 5 points to you in all. Thanks very much.
Regards,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 02:24 PM
11-28-2007 02:24 PM
Re: Get HP Unix System Memory & CPU Usage
Have you read "How many points should I assign to replies?":
http://forums1.itrc.hp.com/service/forums/helptips.do?#34
Each reply is eligible for points.
And if you got all our answers you should close the thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2007 03:53 PM
11-28-2007 03:53 PM
Re: Get HP Unix System Memory & CPU Usage
Thanks for pointing me to the points link. Actually my original objective is to get Unix System CPU and Memory usage. I was already checking out SAR and memdetail programs when I posted that message. I used SAR for getting cpu usage and memdetail for getting memory usage. I had an issue with memdetail execution (binary) and compiling (memdetail.c file) which I could fix with your assistance. Hence I assigned 5 points to you.
As a part of the original question, I would also like to know other easier ways to get cpu, mem usage of an unix system through a java program (say using getRuntime().exec() etc.). I feel glance is one of the most accurate tools on hp-ux system with lot of system details. If someone have done this using glance please share the code in this forum.
Thanks & Regards,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2007 01:29 AM
11-29-2007 01:29 AM
Re: Get HP Unix System Memory & CPU Usage
Yet another way to get a ton of info is through the Performance Agent...
I use extract to grab the stats daily from some of my larger environemnts...
I just cut and paste into Excel, tools, text to columns, delimited by |
From root's cron:
# performance
55 23 * * 1-5 /opt/perf/bin/extract -xp -r /home/gwild/zgbltemplate -g -b today 7:00 -e today 18:00 -f stdout | /bin/mailx -s 'IPR performance report' sysadm >/dev/null 2>&1
# cat /home/gwild/zgbltemplate
REPORT "MWA Export on !SYSTEM_ID"
FORMAT ASCII
HEADINGS ON
SEPARATOR="|"
SUMMARY=60
MISSING=0
DATA TYPE GLOBAL
YEAR
DATE
TIME
GBL_CPU_TOTAL_UTIL
GBL_CPU_SYS_MODE_UTIL
GBL_CPU_USER_MODE_UTIL
GBL_CPU_SYSCALL_UTIL
GBL_CPU_INTERRUPT_UTIL
GBL_PRI_QUEUE
GBL_CPU_CSWITCH_UTIL
GBL_SWAP_SPACE_UTIL
GBL_DISK_UTIL_PEAK
GBL_DISK_SUBSYSTEM_QUEUE
GBL_MEM_UTIL
GBL_MEM_CACHE_HIT_PCT
GBL_MEM_PAGEIN_RATE
GBL_MEM_PAGEOUT_RATE
GBL_MEM_SWAPIN_RATE
GBL_MEM_SWAPOUT_RATE
GBL_MEM_QUEUE
GBL_NET_PACKET_RATE
GBL_NET_OUTQUEUE
GBL_NETWORK_SUBSYSTEM_QUEUE
There are plenty of metrics....
https://h10078.www1.hp.com/cda/hpms/display/main/hpms_content.jsp?zn=bto&cp=1-11-15-28^1792_4000_100
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2007 11:10 PM
12-03-2007 11:10 PM
Re: Get HP Unix System Memory & CPU Usage
Thanks for the details and very sorry for the delay in my reply. I think, now I have enough information. Thanks to one and all who posted valuable information. I will close this topic.
Regards,
Dhinakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2007 11:12 PM
12-03-2007 11:12 PM