This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Performance and the fly likes Shell script for JVM heap size monitoring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Shell script for JVM heap size monitoring" Watch "Shell script for JVM heap size monitoring" New topic

Shell script for JVM heap size monitoring

P B Madhavan

Joined: Dec 23, 2009
Posts: 5
Hi Guys,

We have a websphere portal application (v6.1) and it is running on AIX.

I require a simple shell script to probe the JVM heap size and echo an error message if the heap size utilization exeeds a threshold.

Thanks in advance, hope someone can help me here, I am not an expert in Unix shell scripting.


P B Madhavan
Peter Johnson

Joined: May 14, 2008
Posts: 5852

P B, welcome to Java Ranch!

Are you talking about overall heap size, or about heap usage? Either way, I don't think that such a script will do for you what you think it will. In the former case, heaps tend to increase in size as the app is used, especially with apps such as Java EE application servers. For the latter, once the heap usage reaches a certain amount, a major garbage collection will come along and free a bunch of space. You can observe both of these by hooking up either jconsole or jvisualvm to your Java app.

By the way, what is it that you are really looking for?

JBoss In Action
Andrei Matyas

Joined: Apr 15, 2007
Posts: 25
I do not know if jmap command is available on an AIX system. If not may be this link will be usefull:
I agree. Here's the link:
subject: Shell script for JVM heap size monitoring
It's not a secret anymore!