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,statisti...