Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a jboss-4.2.3.GA installation where I suspect the thread pool may be incrising over time due to threads not being properly released. I am not getting any messages when maxthreads is reached, So I would like to log the number of threads in use to a file every five minutes so I can verify this hypothesis. Would anyone please be able to advise how this can be be done?

share|improve this question

You can use JMX to get the thread count from java. with the addon jmx4perl you can do JMX calls from a very basic perl script. There is also an addon for Nagios to integrate with j4p for alerting and monitoring of various parameters. has a few good examples.

share|improve this answer

I know this is an old question, but someone might find this interesting. I had a similar problem where I wanted the monitor the jboss connection pools toward the database. What I did was to create a small shell script that each second minute used curl to fetch the relevant page from JBoss jmx-console.

I ended up using something like this in my bash script.

# Pools to check
POOLS="DefaultDS QuartzDS"

# Loop thru the pools and collect stats.
for pool in $POOLS;
    # Construct the URL
    # Use 'curl' to fetch the web page, and awk to parse the output and put all rows with 'count' in them in a temp file.
    curl $url | awk 'BEGIN{RS="<td>MBean"}/Count/{print $0}' > _tmp_PoolStat.txt
    echo "Processing $pool"

    <process data in tmp file using your favourite tool.>

In your case you need to alter the url to match what you are looking for. Since I use a *nix based OS I ended up using watch to execute this script at a fixed interval.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.