Site icon techieswiki

How to configure TIBCO EMS Microagent to monitor EMS using Hawk?

As you know TIBCO Hawk is used for monitoring distributed systems. Hawk monitors the system or process by using the microagents. Same way to monitor TIBCO EMS, we need to add a microagent to it.

Read What is TIBCO Hawk and How does it works?

Why do we need to add the Microagent manually?

TIBCO EMS is a tool which we are installing and configuring based on our requirement. The EMS connection URL and credentials will be different for each EMS. Hawk doesn’t have the functionality to find it automatically. So we need to add this configuration to hawk by using an HMA file.

Let’s discuss it in step by step.

Identify Plugin Directory

Hawk Agent will be looking for additional plugins (microagent) in a directory which we mentioned in the hawk agent.cfg file when its start each time. By default, the plugin directory will be under [TIBCO-HOME]/tra/domain/[DOMAIN-NAME]/plugin. hawkagent.cfg file will have an entry like below. You are free to change this location based on your requirement.

# Specifies the directory used for hawk microagent plug-in configuration.
-hma_plugin_dir "[TIBCO-HOME]/domain/[DOMAIn-NAME]/plugin"

Copy hawkemshma.jar file

Once we identify the plugin directory, we need to copy the hawkemshma.jar file from [TIBCO-HOME]/hawk/[VERSION]/plugin/ems to [TIBCO-HOME]/tra/domain/[DOMAIN-NAME]/plugin directory.

Create an HMA file

Sample HMA file will be available under [TIBCO-HOME]/hawk/[VERSION]/plugin/ems directory. We can copy it the plugin directory with the name you like.

<microagent>
  <!-- The classname of the microagent,  this class if available in hawkemshma.jar file-->
  <classname>com.tibco.hawk.tibjms.HawkController</classname>

  <!-- The arguments to be passed to the MicroAgent.initializeMicroAgent() method -->
  <arguments>
    <arg>-user</arg>
    <arg>admin</arg>
    <arg>-password</arg>
    <arg>admin</arg>
    <arg>-server</arg>
    <arg>tcp://DESKTOP-GBN1912:7020</arg> 
    <arg>-version</arg>
    <arg>8.0</arg>  
    <!--Trace Configuration -->		
    <arg>-traceDir</arg>
    <arg>C:/ProgramData/TIBCO_HOME/tibco/cfgmgmt/hawk/logs</arg>
    <arg>-traceFilename</arg>
    <arg>emshma.log</arg>		
    <!-- Trace Level  -->
    <!-- WARNING=2, ERROR=4, INFO=7, DEBUG=8 -->
    <arg>-traceLevel</arg>
    <arg>8</arg>
    </arguments>
  <classpath>
      <path>hawkemshma.jar</path>
  </classpath>
</microagent>

If a simple jar file name is used in the classpath then the jar file must reside in the same directory as this .hma file. Or else you can specify the absolute path to the jar file. In that case, you don’t need to copy it to the plugin directory.

SSL Connection

If you configured the EMS server with an SSL, you need to pass some additional arguments in hma file.

<microagent>
  <!-- The classname of the microagent -->
  <classname>com.tibco.hawk.tibjms.HawkController</classname>
  <arguments>
    <arg>-user</arg>
    <arg>admin</arg>
    <arg>-password</arg>
    <arg></arg>
    <arg>-server</arg>
    <arg>ssl://localhost:7243</arg>
    <arg>-version</arg>
    <arg>8.0</arg>  
    <arg>-traceDir</arg>
    <arg>C:/ProgramData/TIBCO_HOME/tibco/cfgmgmt/hawk/logs</arg>
    <arg>-traceFilename</arg>
    <arg>emshma.log</arg>
    
    <arg>-traceLevel</arg>
    <arg>7</arg>
    <arg>-ssl_trace</arg>
    <arg>-ssl_vendor</arg>
    <arg>j2se</arg>
    <arg>-ssl_trusted</arg>
    <arg>C:/tibco/ems/8.4/samples/certs/server_root.cert.pem</arg>
    <arg>-ssl_private_key</arg>
    <arg>C:/tibco/ems/8.4/samples/certs/server.key.p8</arg>
    <arg>-ssl_expected_hostname</arg>
    <arg>server</arg>
    <arg>-ssl_password</arg>  
    <arg>#!RbhuxizyNviD+AS7Aaa1jSt3++aPaaJL7eBcNhaJyRs=</arg>     
  </arguments>
  <classpath>
      <path>hawkemshma.jar</path>	
  </classpath>		
</microagent>

Restart the hawkagent

Once all the above step is completed, restart the hawk agent. Now you should be able to see the EMS microagent in hawkdisplay. For a successful run, emshma.log will have the following lines.

DEBUG   2019/03/22 11:15:37.658  Configured parameters=[-user, admin, -password, admin, -server, tcp://7020, -version, 8.0]
DEBUG   2019/03/22 11:15:37.658  Configured JMS Server User = admin
DEBUG   2019/03/22 11:15:37.659  Configured JMS Server URL = tcp://DESKTOP-GBN1912:7020
DEBUG   2019/03/22 11:15:37.659  Loading MicroAgentName=com.tibco.hawk.tibjms.HawkController MicroAgentDescriptor=/com/tibco/hawk/tibjms/EMSMicroAgent8.mad DisplayName=JMS_controller (tcp://7020)
DEBUG   2019/03/22 11:15:37.683  Got MicroAgent descriptor.

Hawk Display

After the restart, the microagent list will have JMS_controller with the connection URL which we provided in the HMA file. In the below screenshot I invoked the getQueues method which will list all the queues.

TIBCO Hawk Display – EMS Microagent

Now you are all set to monitor the EMS server and take some action depends on your need. The same way you can add as many EMS servers by creating additional HMA files.

Hope this tutorial helps you. Let me know your feedback and doubts in the comment section.

Exit mobile version