我在 java 参数中使用 jmxtrans 作为代理,并为指标传递 jmxtrans-agent.xml。目前,我正在获取 JVM(JVM 内存池)的指标,但我没有看到任何线程和数据源的指标。您能否建议要使用的对象和属性。我正在使用 tomcat 8 服务器。
<?xml version="1.0" encoding="UTF-8"?>
<jmxtrans-agent>
<invocations>
<invocation objectName="java.lang:type=Memory" operation="gc" resultAlias="jvm.gc" />
</invocations>
<queries>
<!-- OS -->
<query objectName="java.lang:type=OperatingSystem" attribute="SystemLoadAverage" resultAlias="os.systemLoadAverage" />
<!-- JVM -->
<query objectName="java.lang:type=Memory" attribute="HeapMemoryUsage" key="used" resultAlias="jvm.heapMemoryUsage.used" />
<query objectName="java.lang:type=Memory" attribute="HeapMemoryUsage" key="committed" resultAlias="jvm.heapMemoryUsage.committed" />
<query objectName="java.lang:type=Memory" attribute="NonHeapMemoryUsage" key="used" resultAlias="jvm.nonHeapMemoryUsage.used" />
<query objectName="java.lang:type=Memory" attribute="NonHeapMemoryUsage" key="committed" resultAlias="jvm.nonHeapMemoryUsage.committed" />
<query objectName="java.lang:type=ClassLoading" attribute="LoadedClassCount" resultAlias="jvm.loadedClasses" />
<query objectName="java.lang:type=Threading" attribute="ThreadCount" resultAlias="jvm.thread" />
<!-- TOMCAT -->
<query objectName="Catalina:type=GlobalRequestProcessor,name=*" attribute="requestCount" resultAlias="tomcat.requestCount" />
<query objectName="Catalina:type=GlobalRequestProcessor,name=*" attribute="errorCount" resultAlias="tomcat.errorCount" />
<query objectName="Catalina:type=GlobalRequestProcessor,name=*" attribute="processingTime" resultAlias="tomcat.processingTime" />
<query objectName="Catalina:type=GlobalRequestProcessor,name=*" attribute="bytesSent" resultAlias="tomcat.bytesSent" />
<query objectName="Catalina:type=ThreadPool,name=*" attribute="currentThreadCount" resultAlias="tomcat7-connectors" />
<query objectName="Catalina:type=DataSource,class=javax.sql.DataSource,name=*" attribute="numActive" />
<query objectName="Catalina:type=ThreadPool,name=*" attribute="currentThreadCount" resultAlias="tomcat.currentThreadCount" />
<query objectName="Catalina:type=ThreadPool,name=*" attribute="currentThreadsBusy" resultAlias="tomcat.currentThreadsBusy" />
<!--<query objectName="jboss.as.datasources.OracleDS.pool" attribute="ActiveCount" resultAlias="Active.Pool.Count" />
<query objectName="jboss.as:subsystem=datasources,xa-data-source=OracleDS,statistics=pool" attribute="MaxUsedCount" />
<query objectName="jboss.as:subsystem=datasources,xa-data-source=OracleDS,statistics=pool" attribute="AvailableCount" resultAlias="foo" />
<query objectName="jboss.as.expr:xa-data-source=OracleDS,statistics=pool" attribute="AvailableCount" resultAlias="foo" />-->
<!-- APPLICATION -->
<query objectName="Catalina:type=Manager,context=/,host=localhost" attribute="activeSessions" resultAlias="application.activeSessions" />
</queries>
<outputWriter class="org.jmxtrans.agent.StatsDOutputWriter">
<host>server</host>
<port>8125</port>
<tags>jmx_</tags>
</outputWriter>
<collectIntervalInSeconds>10</collectIntervalInSeconds>
</jmxtrans-agent>