用于驼峰路由监控的RHQ / JON代理配置

时间:2012-12-04 11:31:36

标签: monitoring apache-camel custom-routes rhq

我已经编写了自定义插件,用于监控Jboss Operational Network(JON)上的camel路由。 但在RHQ server / JON中,没有添加任何指标用于监控。

在RHQ-agent日志文件中,我能够看到以下内容。

2012-12-04 13:47:13,515 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Executing discovery for [Srikanth Custom Service] Resources...
2012-12-04 13:47:13,515 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- Discovering MBean resources with object name query template: org.apache.camel:type=routes,*
2012-12-04 13:47:13,531 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- Found [1] mbeans for query [org.apache.camel:type=routes,*].
2012-12-04 13:47:13,531 DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent)- **[0] services have been added**
2012-12-04 13:47:13,531 DEBUG [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Discovery for [Srikanth Custom Service] resources completed in [16] ms

这里我发送部署在ON JON上的插件代码。

RHQ-plugin.xml的

<?xml version="1.0" encoding="UTF-8" ?>
<!-- Writing custom plugin for RHQ/JON -->
<plugin name="SampleRHQPlugin"
        displayName="Sample RHQ JMX Plugin"
        version="1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="urn:xmlns:rhq-plugin"
        xmlns:c="urn:xmlns:rhq-configuration">
    <!-- Writing custom plugin for RHQ/JON -->
   <depends plugin="JMX" useClasses="true"/>
<!-- Custom service metrics-->
    <service name="Srikanth Custom Service"
            description="Our Srikanth MBean custom service that has a code associated with it."
            discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent"
            class="org.rhq.plugins.jmx.MBeanResourceComponent">
<!-- Custom run Inside-->
      <runs-inside>
         <parent-resource-type name="JMX Server" plugin="JMX"/>
         <parent-resource-type name="JBossAS Server" plugin="JBossAS"/>
      </runs-inside>

<!-- plugin configuration metrics-->
      <plugin-configuration>
      <c:simple-property name="objectName" readOnly="true" default="org.apache.camel:type=routes,*" /> 
        <c:simple-property name="connectorAddress" default="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-root" required="false" type="string" description="The connection url in the form of a JMXServiceURL - this should only be set if the JVM has JMX Remoting enabled" /> 
        <c:simple-property name="installURI" required="false" type="string" description="The installation path for the selected server type which will be used to find client libraries (if appropriate)" /> 
        <c:simple-property name="principal" required="false" default="smx" description="The login principal/username" /> 
        <c:simple-property name="credentials" required="false" type="password" default="smx" description="The login credentials/password" /> 
      </plugin-configuration>
<!-- Custom metrics-->
      <metric property="ExchangesCompleted"
              displayName="ExchangesCompleted"
              defaultOn="true"
              displayType="summary"
              defaultInterval="30000"
              description="Number of completed exchanges"/>
    <!-- END of Custom metrics -->
   </service>   
   <!-- END of service -->
</plugin>
<!-- END of plugin-->

如何将此ExchangesCompleted指标添加到JON服务器以进行监控?

请帮帮我。

2 个答案:

答案 0 :(得分:2)

为了确保,您是否知道JON为Red Hat提供的Fuse产品提供了一个插件?

我知道在撰写您的消息时,它尚未得到支持和提供,因为JBoss品牌的Fuse产品尚未发布。

希望,但是现在,你已经使用了这些插件而不必重新发明轮子。

干杯。

答案 1 :(得分:0)

虽然我对Fuse产品几乎一无所知,但我怀疑你根本没有在

中找到属性名称的正确表达式
<metric property="ExchangesCompleted"

特别是在这里使用对象名称模式时:

  <c:simple-property name="objectName" readOnly="true" default="org.apache.camel:type=routes,*" /> 

确保对于org.apache.camel:type=routes,* ExchangesCompleted的对象,{{1}}确实存在。

也许首先要通过不使用对象名称模式来缩小范围,而是使用一个具体的对象名称。