我正在尝试使用asadmin接口来监控GlassFish 3.1.1上的线程池。我正在执行以下命令:
asadmin get -m server.network.my-listener.thread-pool.*
我正在获取数据,但大多数数据的lastsampletime = -1 (因此相关数据为零;没有价值)。
注意:我还尝试了REST接口和JMX接口。同样的问题:大部分数据的lastsampletime = -1。
我已经将所有模块的监控设置为高。我遗漏了什么?
发布于 2011-11-18 04:57:45
似乎需要重新部署我的应用程序才能让监控真正获得值。也许我对手册的理解有误,但它似乎表明不需要重新启动/重新部署:
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-service监视:
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
发布于 2011-11-08 23:42:55
这就是您需要做的全部工作。
对于要将应用程序monitor.
asadmin get -m *instancename*.network.*listener*.thread-pool.*
的DAS、独立实例或群集上的
HIGH
由于您使用的是asadmin get -m server.network.my-listener.thread-pool.*.
,因此看起来您正在监视DAS
我在DAS上部署了一个简单的war,并发出了一堆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.
发布于 2017-04-02 22:48:47
要在不重新启动的情况下立即启用监控,请使用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-service模块必须具有高级别才能获得监控信息。
有关更多信息,请参阅https://docs.oracle.com/cd/E26576_01/doc.312/e24928/monitoring.htm#GSADG00558
https://stackoverflow.com/questions/7985981
复制相似问题