Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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;
do
    # Construct the URL
    url=http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean\&name=jboss.jca:service=ManagedConnectionPool,name=$pool
    # 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.>
done

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

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.

http://blog.techstacks.com/2009/09/tomcat-management-jmx4perl-makes-it-easier.html has a few good examples.

share|improve this answer

Your Answer

 
discard

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.