1 Reply Latest reply on Apr 19, 2010 12:46 PM by mschoechlin

    Exporting JMX attributes over SNMP: JMX, snmp-adaptor.sar and Spring

    mschoechlin

      Hi,


      i implemented some jmx-attributes using Spring 3.0.
      (see spring descriptor below) 


      I start JBOSS with the following arguments:

       

       

      JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=21099 "
      JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.password.file=${JBOSS_CONFIGDIR}/${JBOSS_INSTANCE}/jmx.password"
      JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.access.file=${JBOSS_CONFIGDIR}/${JBOSS_INSTANCE}/jmx.access"
      JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
      JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
      

       

      In JConsole and VisualVM the jmx-mbeans of my war are visible - but for some reason
      these mbeans cannot be mapped in snmp-adaptor.sar.
      (see attributes.xml snippet below)

       

      I can see the following output in the jboss server.log when fetching the value by invoking snmpwalk
      (snmpwalk -v 2c  -On -c public localhost:1161 .1.3.6.1.4.1.4952.100.200.1.1):

      15:38:07,176 WARN  [SnmpAgentService] getValueFor (foobar:name=NachrichtenVerarbeitung, DatensatzLaufzeit: javax.management.InstanceNotFoundException: foobar:name=EinarbeitungsnachrichtVerarbeitung is not registered.

       

      Other mbeans (i.e. datasource jmx attributes) which are only visible in jmx-console (and not in jconsole)
      can be successfully mapped by snmp-adaptor.sar.


      It seems that this problem is caused by some type of scopeing - what can i do to make the
      mbeans of a war-application visible to snmp-adaptor.sar?

       

      Best regards
      Marc Schoechlin

       

      Details:
      -----------------------------------------------------------------------------------------------------------------------------------

       

      The spring descriptor:
      
      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
      
       
         <!-- Mbeans zur statistischen Auswertung via JMX exportieren -->
         <bean id="exporter"
            lazy-init="false">
            <property name="autodetect" value="true"></property>
            <property name="namingStrategy" ref="namingStrategy"></property>
            <property name="assembler" ref="assembler"></property>
         </bean>
      
       
         <bean id="attributeSource"
            />
      
       
         <bean id="assembler"
           >
            <property name="attributeSource" ref="attributeSource" />
         </bean>
      
       
         <bean id="namingStrategy"
           >
            <property name="attributeSource" ref="attributeSource" />
         </bean>
      
       
      </beans>
      
      

       

      attributes.xml snippet:

         <mbean name="foobar:name=NachrichtenVerarbeitung" oid-prefix=".1.3.6.1.4.1.4952.100.200.2">
           <attribute name="DatensatzLaufzeit" oid=".1"/>
           <attribute name="DatesaetzeProStunde" oid=".2"/>
           <attribute name="Fehleranzahl" oid=".3"/>
           <attribute name="MessageCount" oid=".4"/>
           <attribute name="MessageTime" oid=".5"/>
         </mbean>