Site icon techieswiki

how to monitor or query a database using Tibco hawk

Hawk is designed to monitor the Tibco applications running on the servers. And for this, it needs hawk agent present on the server which acts as the interface for the applications. Now we have a requirement to monitor databases running on different servers.

Why do we need to monitor the database?

Consider we have a TIBCO BW process which reads from an EMS queue and writes the data into a Database. In this scenario, if the Database is down or not able to access BW process will try to insert the data into the Database and it will fail. Depends on the BW code logic we may or may not lose the data, Also once it failed we might need to manually restart the BW after the Database is back online.

Think like if we can use the hawk to monitor the database and stop the BW process if the Database is down or not accessible and start the BW back once the Database came back online. By this way, we can avoid data loss and manual effort.

JDBC Ping is not bundled with default Hawk installation. You need to create a custom microagent for this or need to reach out to TIBCO Support.

Let’s discuss in step by step.

Find the plugin directory from the hawkagent.cfg file. The file will have a similar to below.

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

Now copy the JDBCPing.jar file to this directory. After copying, create JDBCPing.hma file and add the below entries to it.

<microagent> 
    <classname>com.tibco.hawk.plugin.JDBCPing</classname>  
    <arguments></arguments>
    <classpath> 
        <path>JDBCPlugin.jar</path>
        <path>classes12.jar</path>
        <path>terajdbc4.jar</path>
        <path>tdgssjava.jar</path>
        <path>tdgssconfig.jar</path>
      <path>mysql-connector-java-5.1.7-bin.jar</path>
      <path>sqljdbc4.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.

Restart the TRA

After completes the above steps restart the TRA. Now you should be able to see the JDBCPing microagent in hawk display like in below image.

JDBC Ping hawk microagent

Hope this post is helpful for you. Let me know your doubts and feedback in the comment section.

Exit mobile version