如何通过asadmin接口监视GlassFish线程池

时间:2011-11-02 19:07:24

标签: glassfish monitoring

我正在尝试使用asadmin接口来监视GlassFish 3.1.1上的线程池。我正在执行以下命令:

asadmin get -m server.network.my-listener.thread-pool.*

我正在收回数据,但大多数都有lastsampletime = -1(因此相关数据为零;并且没有价值)。

注意:我也尝试过REST接口,我相信asadmin委托给它,以及JMX接口。同样的问题:大部分数据都有lastsampletime = -1。

我已经将所有模块的监控设置为HIGH。我错过了什么?

3 个答案:

答案 0 :(得分:6)

似乎重新部署我的应用程序是监控实际获取值所必需的。也许我错误地解释了手册,但它似乎表明不需要重新启动/重新部署:

Oracle GlassFish Server 3.1 Administration Guide

另外,下面显示没有监控数据,这很奇怪:

asadmin get -m server.thread-pools.thread-pool.http-thread-pool.*

相反,您必须通过特定的网络侦听器,如:

asadmin get -m server.network.http-listener-2.thread-pool.*

令我惊讶的是,启用线程池监视不足以查看线程池统计信息。您还必须启用http服务监控:

asadmin enable-monitoring
asadmin set server.monitoring-service.module-monitoring-levels.thread-pool=HIGH
asadmin set server.monitoring-service.module-monitoring-levels.http-service=HIGH

答案 1 :(得分:5)

这就是你应该做的所有事情。

  1. 为要监视的DAS,独立实例或群集上的http服务模块启用监视,设置为HIGH
  2. 将应用程序部署到DAS,独立实例或群集并发出http请求。
  3. asadmin get -m *instancename*.network.*listener*.thread-pool.*
  4. 看起来您正在监控DAS,因为您使用的是asadmin get -m server.network.my-listener.thread-pool.*.

    我向DAS部署了一个简单的战争并发出了一堆http请求。我看到corethreads-count和maxthreads-count的最后一个采样时间为-1。剩下的统计数据包含实际的最后采样时间。

    asadmin get -m "server.network.http-listener-1.thread-pool.*"
    server.network.http-listener-1.thread-pool.corethreads-count = 0
    server.network.http-listener-1.thread-pool.corethreads-description = Core number of threads in the thread pool
    server.network.http-listener-1.thread-pool.corethreads-lastsampletime = -1
    server.network.http-listener-1.thread-pool.corethreads-name = CoreThreads
    server.network.http-listener-1.thread-pool.corethreads-starttime = 1320764890444
    server.network.http-listener-1.thread-pool.corethreads-unit = count
    server.network.http-listener-1.thread-pool.currentthreadcount-count = 5
    server.network.http-listener-1.thread-pool.currentthreadcount-description = Provides the number of request processing threads currently in the listener thread pool
    server.network.http-listener-1.thread-pool.currentthreadcount-lastsampletime =  1320765351708
    server.network.http-listener-1.thread-pool.currentthreadcount-name = CurrentThreadCount
    server.network.http-listener-1.thread-pool.currentthreadcount-starttime = 1320764890445
    server.network.http-listener-1.thread-pool.currentthreadcount-unit = count
    server.network.http-listener-1.thread-pool.currentthreadsbusy-count = 0
    server.network.http-listener-1.thread-pool.currentthreadsbusy-description = Provides the number of request processing threads currently in use in the listener thread pool serving requests
    server.network.http-listener-1.thread-pool.currentthreadsbusy-lastsampletime = 1320765772814
    server.network.http-listener-1.thread-pool.currentthreadsbusy-name = CurrentThreadsBusy 
    server.network.http-listener-1.thread-pool.currentthreadsbusy-starttime = 1320764890445
    server.network.http-listener-1.thread-pool.currentthreadsbusy-unit = count
    server.network.http-listener-1.thread-pool.dotted-name = server.network.http-listener-1.thread-pool
    server.network.http-listener-1.thread-pool.maxthreads-count = 0
    server.network.http-listener-1.thread-pool.maxthreads-description = Maximum number of threads allowed in the thread pool
    server.network.http-listener-1.thread-pool.maxthreads-lastsampletime = -1
    server.network.http-listener-1.thread-pool.maxthreads-name = MaxThreads
    server.network.http-listener-1.thread-pool.maxthreads-starttime = 1320764890443
    server.network.http-listener-1.thread-pool.maxthreads-unit = count
    server.network.http-listener-1.thread-pool.totalexecutedtasks-count = 31
    server.network.http-listener-1.thread-pool.totalexecutedtasks-description = Provides the total number of tasks, which were executed by the thread pool
    server.network.http-listener-1.thread-pool.totalexecutedtasks-lastsampletime = 1320765772814
    server.network.http-listener-1.thread-pool.totalexecutedtasks-name = TotalExecutedTasksCount
    server.network.http-listener-1.thread-pool.totalexecutedtasks-starttime = 1320764890444
    server.network.http-listener-1.thread-pool.totalexecutedtasks-unit = count
    
    Command get executed successfully.
    

答案 2 :(得分:0)

要立即启用监控而不重启,请使用enable-monitoring命令

enable-monitoring
enable-monitoring --modules jvm=LOW
enable-monitoring --modules thread-pool=HIGH
enable-monitoring --modules http-service=HIGH
enable-monitoring --modules jdbc-connection-pool=HIGH

诀窍是线程池和http服务模块必须具有高级别才能获得监控信息。

有关详细信息,请参阅https://docs.oracle.com/cd/E26576_01/doc.312/e24928/monitoring.htm#GSADG00558