JAR-less plugins for RHQ
Mazz has written a few times about the Custom-JMX plugin (funnily enough I did not find a newer post to link to), which is basically a plugin descriptor, that re-uses the classes from the base JMX plugin.
While this is very powerful, it has the small usability drawback of requiring to wrap the descriptor into a jar file to be recognized by the server (and the agents).
I have now implemented BZ 741682 which allows to deploy plugin descriptors only. For this to work
- the file needs to be called *-rhq-plugin.xml (e.g. foo-rhq-plugin.xml)
- the classes of the plugin need to already be present on the agent
The latter can be achieved by putting a depends directive into the descriptor:
<depends plugin="JMX" useClassed="true"/>
In the following example you see the
bar-rhq-plugin.xml file picked up from the
(the "drop-box") and placed into the plugins directory inside the app:
09:18:55,160 INFO [PluginDeploymentScanner] Found plugin descriptor at [/im/dev-container/plugins/bar-rhq-plugin.xml] and placed it at [/im/dev-container/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins/bar-rhq-plugin.xml]
Next is the transformation of this plugin descriptor into a jar file - if this is successful, the now obsolete plugin descriptor is removed.
09:18:55,403 INFO [AgentPluginScanner] Found a plugin-descriptor at [/im/dev-container/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins/bar-rhq-plugin.xml], creating a jar from it to be deployed at the next scan 09:18:55,411 INFO [AgentPluginScanner] Deleted the now obsolete plugin descriptor: true
At the next scan of the deployment scanner, the scanner will pick up this generated jar and deploy it like any other plugin:
09:19:26,470 INFO [ProductPluginDeployer] Discovered agent plugin [bar-test] 09:19:26,474 INFO [ProductPluginDeployer] Deploying  new or updated agent plugins: [bar-test] 09:19:26,656 INFO [ResourceMetadataManagerBean] Persisting new ResourceType [bar-test:test(id=0)]... 09:19:29,344 INFO [ProductPluginDeployer] Plugin metadata updates are complete for  plugins: [bar-test]
The last step would then be to run
plugins update on the agent to get this new plugin from the server and to deploy it into the agent.