TIBCO HAWK is a well known and widely used monitoring tool used to monitor distributed applications and processes in real time to take necessary corrective and preemptive actions at the right time to avoid major financial losses for the businesses.
In this step by step HAWK tutorial, I am going to explain how to create new rules in the RuleBase for a deployed TIBCO Application and then generate alerts based on the configured rules.
As an example case, I am taking a simple scenario for this tutorial. I have developed a simple BW process that received HTTP Request, Queries a database table and then sends back HTTP Response. In case of any exception in the process, process starter is suspended by using Engine Command (this suspension logic is only valid for this example and in real projects, you won’t be having such suspension logic on exceptions).
Let’s now go step by step with this TIBCO Hawk Tutorial.
Step 1: Design TIBCO BW Process and Create its EAR
The process that I have created (HTTP Test Process), queries a database table TBL_TEMP_FILES as shown in below screenshot:
After catching the exception, below engine command is used to suspend the process starter as I will be creating alert using TIBCO HAWK based on this state change:
I am not going to explain each and every activity of the process as most of them are just straight forward.
Validate the process and then create Its EAR by dragging Enterprise Archive resource from General Palette.
In the EAR, include the above process in the PAR. Once added, Build the EAR file.
In the next Step, we will deploy the EAR in the Administrator.
Step 2: Deploy EAR in TIBCO Administrator
Go to Application Management–>All Applications and then select New Application option and choose the EAR file that you created in previous step.
Deploy the EAR and make sure that Its successfully deployed and Its Service Instance is in Running state:
Now we move forward to the main step of this tutorial in which we will create monitoring rule for this deployed service.
Step 3: Create HAWK Monitoring Rulebase and Add Rules and Alerts
Open HAWK Display. HAWK Agents will be discovered as shown below:
As you can see in above screenshot, no Rulebase has been added yet. In the Agent View, right click on the machine name and then by choosing the option Get Configuration, select Rulebases as shown below:
A new window will be opened. In the Rulebase List, click on Create option to create a new Rulebase.
Give this Rulebase a name (I named it as TestRuleBase). Click on Create option in the Rules section. In new opened window, select Data Source. As we want to create rules on our newly deployed service, choose the same. In the Micro Agent methods, choose OnStarterStateChanged:
Now in the Tests option, Create New Test. In the Test Editor, choose the condition by clicking on Edit option.
In the Test Builder window, choose State in Parameter, !Equals in the Operator and give the value ACTIVE in the arguments. By this, we want to test the situations when Process Starter state is not equal to ACTIVE.
After clicking OK button on Test Builder, use Create Option in the Then panel. It will open Action Builder window.
In the Action Builder window, choose Alert as Action Type and give a message in the Message Text Field as shown below:
In the Rulebase List, click on Apply Changes option. We are done with the creation of rulebase, addition of Rule and setting up conditions and actions for the Rule.
Now we move to the next step in which we will test the scenario that how Alerts are triggered and associated actions are performed.
Step 4: Monitor TIBCO Services and View Alerts in Monitoring Management Module
As we built a scenario in which Process Starter Change is being monitored by the HAWK Rule, so we need to take some action which can change the Process Starter state so that Rule condition is met.
In our process that we developed, Engine Command is used to change the Process Starter state in case of any exception in the process. We can cause an exception in the process by introducing some exceptional scenario in the JDBC Query activity. This can be done by dropping the table TBL_TEMP_FILES from the database so that JDBC Query results in an exception.
Use below command in SQL Developer/PlSql Developer to drop the table:
drop table tbl_temp_files
Now, send HTTP Request to the deployed service by using any browser. HTTP Connection that I created in my project was using Localhost as Host and 9858 as port. And data is the GET parameter for the HTTP Receiver.
So I use below URL to send a request to the deployed service:
Now go to Monitoring Management–>All Alerts in TIBCO Administrator and you will see below alert which got created based on the Rule that we added to the Rulebase:
That’s it. Contact me for any further help.