Diskussion  - 
 
Is there any reason generic-jmx.jar should not be backwards compatible?

The issue I have is that I am using collectd 5.4.1with genericjmx to monitor a proprietary
application. The challenge that I am running into is that some of the
exposed MBeans return relevant data as an array:

(this is output of a get -b with jmxterm)

#mbean = com.package:id=my_id,name=random_counter,type=TimeSeries:
ValuePerMinute = [ 430216, 430216, 430216, 430216, 430216, 430216, 430216,
430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216,
430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216,
430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216,
430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216,
430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216,
430216, 430216, 430216, 430216, 430216, 430216, 430216, 430216 ];


Now it looks like this has been resolved in 5.5.2 possibly, however make on 5.5.2 and cping the (collectd-api and/or generic-jmx) jars in place prevents any genericjmx results from being returned. Or does anyone have a suggestion on how to handle this?
1
Geoff Kramer's profile photoFlorian “octo” Forster's profile photo
4 comments
 
So I answered my own question here:
After pulling down multiple instances of generic-jmx.jar I could not get compatibility working and building from source on the machine was not an option due to "Business reasons". Ultimately I pulled down the source code for my version 5.4.1 to local built it copied my jar up with an added logger to figure out the type:

private Number genericObjectToNumber (Object obj, int ds_type) /* {{{ */
{
Collectd.logError ("Class: " + obj.getClass().getName() + "+++");

this threw back a "[J"
which thanks to google is an array of long primitives

so I updated genericObjectToNumber with an extra case

else if (obj instanceof long[])
{
long[] array = (long[]) obj;
return (genericObjectToNumber(array[array.length-1], ds_type));
}

and viola I have my data

as a side note, I also added bools
else if (obj instanceof Boolean)
{
Boolean bool = (Boolean) obj;
return (bool==true?1:0);
}
 
note on file modified /bindings/java/org/collectd/java/GenericJMXConfValue.java
Add a comment...