Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Appendix A Configuring TIBCO ActiveMatrix 3.x Hawk Rulebase Samples

Appendix A
Sample Location
TIBCO_HOME/hkam/<version>/samples/rulebases/readme.txt
The sample provides the following functionality related to the AMX Host microagent and the TIBCO EMS microagent:
Detect when the connected ActiveMatrix Host (TibcoHost) is abnormally shutdown and restart it. Restart is only attempted if, the connected EMS server is running.
Detect when the Administrator Node (SystemNode) was abnormally shutdown and restart it. (Assumes that the SystemNode is also managed by the connected ActiveMatrix Host). Restart is only attempted when the Admin database (if external) is running, and the connected EMS server is running.
A sample DBping microagent is included to support this scenario. Note that the rulebases to support this scenario B are only setup when the ActiveMatrix Administrator instance is created via TCT.
Auto-detect runtime nodes managed by the connected ActiveMatrix Host (TibcoHost), and provide or generate rulebases for each node that restart the node when abnormally shutdown. Restart is only attempted when the connected EMS server is running.
The rulebases and scripts are auto-configured from the output of a TIBCO Configuration Tool (TCT) run.
When TCT is run on a machine to setup either an ActiveMatrix Administrator instance or a TIBCO Host instance, its output directory can be used to configure the Hawk rulebases and scripts to manage the installed ActiveMatrix Administrator and/or TIBCO Host and nodes.
For detailed information on configuring the rulebases and scripts, refer to Configuration Instructions.
Scenarios
Scenario A
Detect when connected TIBCO Host is abnormally shutdown, and restart only if EMS server is running:
Rulebase Name
SystemNodeRB-${tibcohost.instance.name}
Microagents Used
Implementation
Use AMXHost.isHostRunning() to determine if the tibcohost is running
if Running is False
then post 'th_not_running' condition and send Medium level alert: "TibcoHost is not running".
Use AMXHost.getHostInfo to determine runtime state of the tibcohost.
if Runtime State = 'LOST_CONTACT' or Runtime State='NOT_RUNNING'
then post 'th_lost_contact' condition and send Medium alert: "Lost Contact with Tibco Host, Host is in a NOT_RUNNING state".
Use HawkListener<tibcohost.ems.url>.isRunning() to determine the state of the EMS server connected to tibcohost.
if running is True
then post ems.server.<tibcohost.ems.url>.isrunning condition
if running is False
then send High alert: "Tibcohost Qin EMS Server is down: Rules will NOT restart TH".
Use Process.getInstanceCount(ProcessName='tibcohost') to determine
whether there is a running OS process for the tibcohost.
if Process Count < 1 AND the following posted conditions exist:
ems.server.<tibcohost.ems.url>.isrunning AND th_not_running then execute start_tibcohost script, and send High alert: "ActiveMatrix Host is not running, going to restart it."
Scenario B
Detect when the Administrator Node (SystemNode) was abnormally shutdown and restart it, only if the external database (if used) is alive, and if the connected EMS server is running.
Rulebase Name
For external database - SystemNodeRB-extdb-${tibcohost.instance.name}
For embedded database - SystemNodeRB-${tibcohost.instance.name}
Microagents Used
Implementation
During auto-configuration of the rulebases, determine whether an external database is used.
If external database IS used, setup the following rules:
Use AMXHost.onNodeEvent to determine runtime state of the SystemNode.
if Runtime State = 'LOST_CONTACT' or Runtime State='NOT_RUNNING'
then post th_lost_contact_systemnode condition and send High Alert: "Lost Contact with SystemNode"
Use HawkListener<tibcohost.ems.url>.isRunning() to determine the state of the EMS server connected to tibcohost.
if running is True
then post ems.server.<tibcohost.ems.url>.isrunning condition
Use DBPingMicroAgent.ping() to determine the state of the external Database.
if ping is True
then post systemnode.db.isRunning condition
Use Process.getInstanceCount(ProcessName='SystemNode') to determine whether there is a running OS process for the SystemNode.
if Process Count < 1 AND the following posted conditions exist:
ems.server.<tibcohost.ems.url>.isrunning AND th_lost_contact_systemnode AND systemnode.db.isRunning
then execute AMXHost.startNode('SystemNode')
If external database is NOT used, setup the following rules:
Use AMXHost.onNodeEvent to determine runtime state of the SystemNode.
if Runtime State = 'LOST_CONTACT' or Runtime State='NOT_RUNNING'
then post th_lost_contact_systemnode condition and send High Alert: "Lost Contact with SystemNode".
Use HawkListener<tibcohost.ems.url>.isRunning() to determine the state of the EMS server connected to tibcohost.
if running is True
then post ems.server.<tibcohost.ems.url>.isrunning condition.
Use Process.getInstanceCount(ProcessName='SystemNode') to determine whether there is a running OS process for the SystemNode.
if Process Count < 1 AND the following posted conditions exist:
ems.server.<tibcohost.ems.url>.isrunning AND th_lost_contact_systemnode
then execute AMXHost.startNode('SystemNode').
Scenario C
Auto-detect runtime nodes managed by the connected AMX Host (TibcoHost), and provide or generate rulebases for each node that restart the node when abnormally shutdown. Restart is only attempted when the connected EMS server is running.
Rulebase Name
AMXNodeManagerRB
Microagents Used
Use AMXHost.getNodeInfo to determine the names of all nodes (every 30 seconds)
if Node Name != 'SystemNode'
then execute the ANT project : 'scripts/antrunner generate-noderb.xml' with argument amx.node.name= Node Name
then execute the method RuleBaseEngine.loadRuleBaseFromFile(${Node Name}RB-${tibcohost.instance.name}.hrb).
The ANT project generate-noderb.xml will generate a rulebase file in the Hawk autoconfig folder called '${Node Name}RB-${tibcohost.instance.name}.hrb.
This rulebase is based on a template that has the following behavior.
Rulebase Template Name
AMXNodeRB
Microagents Used
Implementation
Use AMXHost.onNodeEvent to determine runtime state of the AMXNode.
if Runtime State = 'LOST_CONTACT' or Runtime State='NOT_RUNNING'
then post th_lost_contact_node condition and send High Alert: "Lost Contact with ${Node Name}".
Use HawkListener<tibcohost.ems.url>.isRunning() to determine the state of the EMS server connected to tibcohost.
if running is True
then post ems.server.<tibcohost.ems.url>.isrunning condition.
Use Process.getInstanceCount(ProcessName=${Node Name}) to determine whether there is a running OS process for the AMXNode.
if Process Count < 1 AND the following posted conditions exist:
ems.server.<tibcohost.ems.url>.isrunning AND th_lost_contact_node
then execute AMXHost.startNode('${Node Name}').

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved