[jboss-jira] [JBoss JIRA] Created: (JBAS-7960) snmp-adaptor.sar: Exporting float jmx attributes does not work

Marc Schoechlin (JIRA) jira-events at lists.jboss.org
Thu Apr 22 10:09:10 EDT 2010


snmp-adaptor.sar: Exporting float jmx attributes does not work
--------------------------------------------------------------

                 Key: JBAS-7960
                 URL: https://jira.jboss.org/jira/browse/JBAS-7960
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: JMX
    Affects Versions: JBossAS-5.1.0.GA
            Reporter: Marc Schoechlin
            Assignee: Dimitris Andreadis


Exporting SNMP float values does currently not work with snmp-adaptor.sar.

Detailed are described in this discussion: http://community.jboss.org/thread/150912

This bug can be fixed by the attached patch:

Due to the fact that there is not compatible type in org.opennms.protocols.snmp.* 
Float is converted to String.

The attached patch is based on:
${code}
$ svn info
Path: .
URL: http://anonsvn.jboss.org/repos/jbossas/trunk
Repository Root: http://anonsvn.jboss.org/repos/jbossas
Repository UUID: 84be2c1e-ba19-0410-b317-a758671a6fc1
Revision: 104117
${code}

The patch:

${code}
ndex: varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java
===================================================================
--- varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java        (revision 104117)
+++ varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java        (working copy)
@@ -483,12 +483,21 @@
             {
                                        ssy = (SnmpObjectId)val;
                                }
-            else if (val instanceof SnmpTimeTicks)
+            else if (val instanceof Float)
+                               {
+                                  /* 
+                                        * Due to the fact that there is not compatible type in org.opennms.protocols.snmp.* we convert 
+                                        * Float to String
+                                        */
+                                       String in = String.valueOf(val);
+                                       ssy = new SnmpOctetString(in.getBytes());
+                               }
+                               else if (val instanceof SnmpTimeTicks)
             {
                ssy = (SnmpTimeTicks)val;
             }
             else
-                                       log.info("Unknown type for " + be);
+                                       log.info("Unknown type for " + be + "(Type was "+val.getClass().getName()+")");
                        }
          catch (Exception e)
          {
${code}




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list