You can use wildcards to define the JMX metric rules to get metrics for all the datasources:
for instance in a JBoss you get get the active count property from the following mbean:
jboss.as:subsystem=datasources,data-source=MyDatasource_01,statistics=pool
When you define the metric rule you have to do it like this:
Object name Match Patern:jboss.as:subsystem=datasources,*,statistics=pool Instance identifier: data-source Atibute:ActiveCount
in the Object Name Match Patern you can even use the wildcard to replace several branches, i.e. if it were "jboss.as:subsystem=datasources,whatever=another_level,whatever=another_level,data-source=MyDatasource_01,statistics=pool" you could use "jboss.as:subsystem=datasources,*,statistics=pool".
the Instance Identifier is the instanced element you want to see separated, in your case you will have something similar to:
jboss.as:subsystem=datasources,data-source=MyDatasource_01,statistics=pool
jboss.as:subsystem=datasources,data-source=MyDatasource_02,statistics=pool
...
jboss.as:subsystem=datasources,data-source=MyDatasource_07,statistics=pool
so you should use data-source as the instance identifier.
Hope I had help you.
Jorge
... View more