oracle-databasejmxoracle-enterprise-manager

How to collect a HashMap using jmx fetchlet


I'm using OEM cloud control 12.1c. I have a java process which is instrumented to collect some metrics in my application. One of the jmx attributes is a Map (java.util.Map).

Now, I want to create a OEM plugin which collects this Map periodically. I tried using jmxcli utility to generate the target metadata, but the tool asks me to enter the keys of the map. The keys are dynamically generated, so these cant be entered while creating the target metadata.

Did any of you face this problem? How do I solve this? I dont want to hardcode the keys, need the complete Map to be displayed in my plugin home page.

Here is a snippet from the console when I selected the Map:

JavaBean (of type Map) is : TypeDistributionMap
0: empty
1: ** User defined Name Values **
Select one or more items as comma separated indices: 1
*** Getting values for User Defined properties

Looping through all user defined Keys. Enter '..' to exit loop.

Enter the key: [This key is dynamic, what should I enter here?]
Enter the DATATYPE of the value: [java.lang.String] 

Solution

  • Instead of using a HashMap (or a Map), it would be better to return TabularData, it is a JMX best practice (and I guess the JMX fetchlet doesn't support Maps). I was able to generate the metadata using jmxcli utility when I used TabularData.