You can use the Oneagent or ActiveGate plugin framework to build one. Actually, things might be a little bit complicated since plugins must be in Python and you will need native DB2 libraries as well on the host where the plugin will be executed. See here for documentation.
If you don't need it as a plugin, you could also do the metrics collection by yourself and push it to Dynatrace through the REST APIs. See here for details.