There are two aspects to your question: (a) observing the state of the existing threads through JMX and (b) low-level discovery for JMX thread monitoring using Zabbix.
Regarding (a), I am currently not aware of any JMX object that would expose this information. By default JVM provides objects like jmx["java.lang:type=Threading",ThreadCount]
and jmx["java.lang:type=Threading",DaemonThreadCount]
, both of which are included in the default "Template JMX Generic". However, I am not aware of any JMX objects that would provide a more detailed information. Please share if you know some.
Regarding (b), there is a built-in item jmx.discovery
, which returns a list of all JMX objects found on the JMX agent. However, with limited filtering abilities and without a possiblity to create an item of the correct type based on {#JMXTYPE}
macro, it was mostly meant for internal testing purposes and that is why it is undocumented.
However, you can find an example of jmx.discovery
at ZBX-6273. With the recent addition of multiple LLD filters in ZBXNEXT-581, you can try filtering the thread objects of interest. Alternatively, you can wait until ZBXNEXT-1223 is implemented or use the patches and utilities mentioned there in the meanwhile. In particular, the recent addition at https://www.zabbix.org/wiki/Docs/howto/jmx_discovery is useful.