1、创建目录 ${ACTIVEMQ_HOME}/jmxtrans-agent/
2、拷贝 jmxtrans-agent-1.2.4.jar 到 ${ACTIVEMQ_HOME}/jmxtrans-agent/ 下面
3、修改 ${ACTIVEMQ_HOME}/bin/activemq 脚本, 在 invoke_start() 和 invoke_console() 添加如下配置:
JMXTRANS_AGENT="-javaagent:${ACTIVEMQ_HOME}/jmxtrans-agent/jmxtrans-agent-1.2.4.jar=${ACTIVEMQ_HOME}/jmxtrans-agent/jmxtrans-agent-activemq.xml"
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $JMXTRANS_AGENT"
拷贝下面的配置文件到 ${ACTIVEMQ_HOME}/jmxtrans-agent/ 下
<jmxtrans-agent>
<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"/>
<!-- ACTIVE MQ -->
<query objectName="org.apache.activemq:type=Broker,brokerName=*,destinationType=Queue,destinationName=*"
attribute="QueueSize" resultAlias="activemq.%brokerName%.queue.%destinationName%.QueueSize"/>
<query objectName="org.apache.activemq:type=Broker,brokerName=*,destinationType=Queue,destinationName=*"
attribute="EnqueueCount" resultAlias="activemq.%brokerName%.queue.%destinationName%.EnqueueCount"/>
<query objectName="org.apache.activemq:type=Broker,brokerName=*,destinationType=Queue,destinationName=*"
attribute="ExpiredCount" resultAlias="activemq.%brokerName%.queue.%destinationName%.ExpiredCount"/>
<query objectName="org.apache.activemq:type=Broker,brokerName=*,destinationType=Queue,destinationName=*"
attribute="DequeueCount" resultAlias="activemq.%brokerName%.queue.%destinationName%.DequeueCount"/>
<query objectName="org.apache.activemq:type=Broker,brokerName=*,destinationType=Topic,destinationName=*"
attribute="EnqueueCount" resultAlias="activemq.%brokerName%.topic.%destinationName%.EnqueueCount"/>
</queries>
<outputWriter class="org.jmxtrans.agent.GraphitePlainTextTcpOutputWriter">
<host>localhost</host>
<port>2203</port>
</outputWriter>
<outputWriter class="org.jmxtrans.agent.ConsoleOutputWriter">
<enabled>false</enabled>
</outputWriter>
<outputWriter class="org.jmxtrans.agent.RollingFileOutputWriter">
<fileName>rollingJMXOutputFile</fileName>
<maxFileSize>10</maxFileSize>
<maxBackupIndex>4</maxBackupIndex>
</outputWriter>
</jmxtrans-agent>
作者:Jeebiz 创建时间:2020-10-20 10:07
更新时间:2024-02-26 11:18
更新时间:2024-02-26 11:18