loggingJboss连接池数量

我有一个jboss-4.2.3.GA安装,我怀疑线程池可能会随着时间的推移,由于线程没有正确释放。 当达到maxthreads时,我没有收到任何消息,所以我想每五分钟logging一次正在使用的线程的数量,以便validation这个假设。 请有人能够build议如何做到这一点?

您可以使用JMX从java中获取线程数。 用插件jmx4perl,你可以从一个非常基本的Perl脚本进行JMX调用。 Nagios还有一个插件可以与j4p集成,以提醒和监视各种参数。

http://blog.techstacks.com/2009/09/tomcat-management-jmx4perl-makes-it-easier.html有几个很好的例子。

我知道这是一个古老的问题,但有人可能会觉得这很有趣。 我有一个类似的问题,我想监视器的jboss连接池朝向数据库。 我所做的就是创build一个小的shell脚本,每一分钟都使用curl从JBoss jmx-console中获取相关页面。

我结束了在我的bash脚本中使用这样的东西。

 # 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 

在你的情况下,你需要改变url来匹配你正在寻找的。 由于我使用基于* nix的操作系统,因此我最终使用watch以固定的时间间隔执行此脚本。