How to write a CEM HTTP Analyzer Plugin

Document created by Guenter_Grossberger Employee on Feb 25, 2015
Version 1Show Document
  • View in full screen mode

Here are the basic steps to create a CEM HTTP Plugin:

 

  1. Create a new Eclipse project (or any other IDE or just use a text editor)
  2. Add the API (cem_plugin.jar) as library or directly to your project and add it to the build path. The API can be downloaded from the TIM UI entry "Download the Java plugin SDK"
  3. Create a new class CemJavaPlugin in the default package (no com.xyz....!) that implements the CemPluginApi (request only) or CemPluginApiV2 (only use if evaluating the response is really necessary):
    1. public class CemJavaPlugin implements CemPluginApi { ... }
  4. Implement the lifecyle methods initialize() and terminate() to create/clear data structures/external connections, ...
  5. Implement the methods of CemPluginApi to gather the information you need and create new plugin parameters (e.g. user group names, composite parameters, parameters extracted from the body, XML extracts, ...) and log messages. An example is included in the plugin API. TheCEM HTTP Plugin Development Guide describes one in detail.
  6. The body of the http request or response may arrive in chunks. So if you need to parse the body of either the request or response: in the request/responseBody() method append all the body parts to a stream object that is stored in a map (see attached example). Then in endRequest/Response() read the whole stream, extract the data you want and remove the stream from the map!
  7. Do as little as possible and as efficiently as possible! The Plugin execution blocks the TIM and is called for every parameter of every request matching the filter.
  8. Test the plugin, e.g. with JUnit tests and use the logMessages part of the CemPluginOutput class to write to the TIM log (remove after testing!)
  9. Build the plugin and deploy it to CEM via the CEM UI
  10. Test
  11. Test more
  12. Remove all log output and redeploy
  13. Use filters to call the plugin only in transactions to specific servers and URLs

 

For more details see:

 

I might publish a few examples on CA APM GitHub over the next few weeks (or months )

2 people found this helpful

Attachments

Outcomes