In one of my previous HAWK tutorials; I explained how you can add hawk monitoring rule for some deployed application to raise an alert when service is not active. In this tutorial, I am going to explain step by step how you can monitor queue on EMS server using HAWK as monitoring tool.
For this tutorial; let’s take a scenario that we have EMS Server where a queue with the name queue.tutorialspedia is being used for EMS based communication. We want to monitor this queue through HAWK rules and want to send Email to operations team whenever pending message count on this queue reaches to a certain number (let’s take the number as 10 for this example though in real time scenarios we won’t be raising alerts for only 10 pending messages).
Step 1: Setup Environment for HAWK EMS Monitoring
In order to enable HAWK based monitoring for EMS, some initial steps are required to ensure that required JAR files are placed in the right location. There are two classes provided by EMS which are used to monitor EMS:
1. HawkListener Class which provides different methods for monitoring destinations (queues, topics), routes and other EMS items on EMS server.
2. HawkController Class which provides EMS administrative methods for management of EMS Server as well other than the methods available in HawkListener class.
Following steps are needed in Windows environment for installing these classes to enable HAWK EMS monitoring.
i. Go to the location EMS_HOME\samples\admin\hawk and copy tibjmsadmin.hma file from this location and paste it in the directory hawk\admin-plugins
ii. Go to the directory EMS_HOME\lib and copy tibjmsadmin.jar, tibjms.jar, jms.jar and tibcrypt.jar files and place these JAR files in the hawk admin plugin directory hawk\admin-plugins
iii. Now open Hawk configuration utility and properly browse and choose admin plugins directory as shown in the screenshot below:
iv. Now go to your admin plugins directory and open the file tibjmsadmin.hma in any text editor. Specify the hawk microagent class to be used and also specify EMS Server details like username, password etc. For my case, Its shown as below:
<!– this is always required –>
Now we are done with all the sub-steps involved in setting up the environment for HAWK EMS monitoring.
Step 2: Configure HAWK Rules for Monitoring EMS Server Queue
Open HAWK Display and then in the Agent View, for the discovered agent; right click and choose Get Configuration–>Rulebases
A new window will open with listing of existing Rulebases. In my case, no rulebase exists. Click on Create button which will open a new window. Give some name to the Rulebase. I named it as QueueManagementRule. Now click on Create button for Rules. In new opened window, for Data Source, click on Edit option and It will open Microagents, methods and arguments window.
Choose JMS_Controller microagent and getQueues method from methods list. In the method arguments in Regular Expression text filed; specify name of the queue (queue.tutorialspedia) as shown below:
Now in the Tests, click on Create option and Rulebase editor window will open. Click on Edit button in front of If textbox and then in the parameter list, choose pendingMessageCount and in the arguments >=10 as shown below:
Now click on Create button for Then part of Rulebase editor so that action editor window gets opened.
In the action type, choose Email and then specify email related information similar way as shown below (use correct configuration information about mail server and recipient in order to send the email):
This completes our HAWK Rule configuration step. Now we are monitoring the queue queue.tutorialspedia on our EMS Server and Email notification will be sent to the given email address when count of pending messages on the queue will reach to 10.
You can test this now by just designing a simple BW process and use JMS Queue Sender activity in the process in a loop to send 10 or more messages to the queue queue.tutorialspedia.
Hope you liked this tutorial. Feel free to comment/contact for any further queries or help. Thanks