TIBCO HAWK Step By Step Tutorial For Adding New Monitoring Rules

By | October 26, 2014

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.

Example Scenario:

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:

hawk tutorial jdbc activity

 

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:

tibco engine command

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:

tibco ear service instance status

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:

tibco hawk display

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:

hawk agent view get rulebases

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:

hawk micro agent choose method

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.

tibco hawk test builder screenshot

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:

tibco hawk action builder screenshot

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:

http://localhost:9858/?data=ajmal

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:

tibco monitoring management hawk alert example

That’s it. Contact me for any further help.

 

Ajmal Abbasi

Ajmal Hussain Abbasi is a TIBCO Consultant By Profession with more than 6 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

10 thoughts on “TIBCO HAWK Step By Step Tutorial For Adding New Monitoring Rules

  1. Pingback: TIBCO HAWK EMS Monitoring: Monitor EMS Queue Using HAWK | TutorialsPedia

  2. Raja

    Ajmal,

    Good share !!! Thanks !!
    Iam aware of the process for monitoring the EMS Queues, here if you would be able to guide me a way to send alert if particular queue whose message size reaches 100MB, and the final alert should be collection of queues of same size but consolidated in single alert ( an single email ) – expecting EMS Rulebase of this type.

    Thanks in Advance.
    Raja

    Reply
  3. sri

    Hi Ajmal,
    Thanks for all your Tutorials which helping a lot for the people.
    I am trying to config Hawk rule base using this tutorial. while configuring it not finding “OnStarterStateChanged” as mentioned in Step3. Finding “OnInstanceChange” using that not seeing Alerts in console when JDBC error catches.

    Followed all these steps as mentioned in this tutorial.
    I thought of attaching screen shot but not finding option.

    Please help me in this.

    Thanks
    Sei

    Reply
  4. ramesha

    GREAT tutorial…….worth reading before the interview…@same time……we can learn also.

    Step-WISE-step !!!

    Reply
  5. Nirmal

    Hi Ajmal,

    I tried to setup hawk rules exactly as you mentioned above. I have few starters running in Flow controlled state as well. So i tried the condition State !Equals ACTIVE AND State !Equals FLOW_CONTROLLED. But alerts are raising only when the status is changed to ACTIVE. I tried all other possible combinations of conditions. But could not achieve what i need. Could you please assist on this?

    Reply
  6. sistla

    Hi ,

    Can you please show me how to create HAWK rules for below metrics for both BW & BE

    Created Number of process instances created for this process definition.
    Suspended Number of times process instances have been suspended.
    Completed Number of process instances that have been successfully completed.
    TotalExecution Total execution time (in milliseconds) for all successfully completed process instances.
    AverageExecution Average execution time (in milliseconds) for all successfully completed process instances.
    AverageElapsed Average elapsed clock time (in milliseconds) for all successfully completed process instances.
    MinElapsed Elapsed clock time (in milliseconds) of the process instance that has completed in the shortest amount of elapsed time.
    MaxElapsed Elapsed clock time (in milliseconds) of the process instance that has completed in the longest amount of elapsed time.
    MinExecution Execution time (in milliseconds) of the process instance that has completed in the shortest amount of execution time.
    MaxExecution Execution time (in milliseconds) of the process instance that has completed in the longest amount of execution time.
    MostRecentExecutionTime Execution time (in milliseconds) of the most recently completed process instance.
    MostRecentElapsedTime Elapsed clock time (in milliseconds) of the most recently completed process instance.
    CountSinceReset Number of process instances that have completed since the last reset of the statistics.

    Thanks

    Reply
  7. Abraham

    Very informative site. Is it possible to get the status of the BW Processes running, The users will be informd on a custom dashboard if the process / engines are running or not.

    We do not have the Hawk Interface where we describe the rule sets.

    Can we use BW Engine command inside the designer and then log the information to a table.

    Reply
  8. Prashaansa

    Hi Ajamal,your ifo is very useful.
    can you provide solution for: how to apply single hawk rule for all bw process running in tibco admin.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *