Adding Custom Hawk Plug-Ins to the Hawk Agent

Hawk plug-in is a Hawk Microagent that resides within the process space of a Hawk agent. These Hawk plug-ins communicate with a host of third-party applications and use the protocols of the third-party applications to monitor and manage them.

You can create your custom Hawk plug-ins and add them to the Hawk agent container. Every plug-in requires a .hma file and a .jar file. The .hma file is a Hawk Microagent configuration file, and the .jar file contains Java implementation of the methods that are exposed through the Hawk subsystem.

Procedure

  1. Create a Java implementation of methods (.jar) that you want for the plug-in.
    For more information, see the <TEMP_DIRECTORY>/tibco.home/hkce/<version>/examples/ma_plugin/SamplePluginMicroagent.java file.
  2. Create the .hma file which defines the custom Hawk plug-in. Refer to the <TEMP_DIRECTORY>/tibco.home/hkce/<version>/examples/ma_plugin/SamplePluginMicroagent.hma file for guidance. Following are the main components of the HMA file:
    1. Most important constituent of this .hma file is the startup class of the plug-in implementation mentioned under the <classname> tag. Example: <classname>com.A.B.myPluginControllerClass</classname>.
    2. You can also specify some optional arguments that you can provide externally without changing the plug-in implementation. Such optional arguments should be mentioned under the <argmuents> tag. Example: <arguments><arg>-traceDir</arg><arg>C:/LogDir</arg></arguments>.
    3. Absolute path of the implementation .jar files and all the required third-party libraries should be mentioned under <classpath> tag. If both of the .hma and .jar files are in same folder, then simple .jar file name is provided in the <classpath> tag. Example: <classpath><path>C:/TPCL/libs/slf4j-api-1.6.4.jar</path></classpath>.
  3. Place the .hma and .jar files of your Hawk plug-in in the folder <TEMP_DIRECTORY>/tibco.home/hkce/<version>/plugin.
  4. Rebuild the Hawk agent Docker image by running the script <TEMP_DIRECTORY>/tibco.home/hkce/<version>/docker/build_hkce_agent.sh.
  5. Run the containers. While running the containers, ensure that the hma_plugin_dir environment variable of hkce_agent is set to value /tibco.home/hkce/<version>/plugin/.
  6. If Hawk Console is running, you can confirm if your plug-in is loaded in Hawk agent by checking the list of microagents in the Hawk console. Check if the methods of the plug-in microagent are listed and if you can invoke and subscribe them.