Monitoring HTTP Listeners in Glassfish 4 via JMX

28 views Asked by At

I need to write a java monitor, to run as a linux service, to monitor the status of http-listeners in Glassfish 4 (really old version). My idea is to be able to find this information via JMX. By connecting my jar via JMX. But, even connecting vi JConsole, I can't figure out which MBeans I should monitor. I need to understand if there are any listeners that remain "stuck" or rather not freed, remaining in a stuck and unreturned state, like in a kind of "limbo."

Can you help me identify which MBeans resource in Glassfish 4 is dipsonable to perform this kind of monitoring? Obviously all http-listeners present must be scanned.

Thanks to all of you.

1

There are 1 answers

0
OndroMih On

You should enable the "Monitoring service" in GlassFish and set level of the "HTTP Service" module to HIGH.

Then you can access monitoring data for network listeners via:

  • HTTP at localhost:4848/monitoring/domain/server/network/http-listener-1/thread-pool
  • JMX beans with names like "amx:pp=/mon/server-mon[server],type=thread-pool-mon,name=network/http-listener-1/thread-pool"

The monitoring bean provides several metrics. To detect that a thread pool is stuck (meaning all threads are stuck and no tasks are getting finished), you can watch the currentthreadsbusy and totalexecutedtasks properties. If, for a longer time, currentthreadsbusy is higher than 1 and totalexecutedtasks doesn't increase, it means that some threads are stuck, working on tasks, but no task gets completed.

Disclaimer: My company, OmniFish, provides commercial support for GlassFish by core GlassFish project developers. Let us know at https://omnifish.ee/contact-us/ if you need some more assistance.