Springboot应用程序 - 获取tomcat线程和数据源的问题

时间:2018-06-12 06:27:23

标签: spring-boot tomcat jmxtrans

我在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>

0 个答案:

没有答案