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


Chapter 3 Common Logging Event Publisher Microagent : com.tibco.hawk.commonlogging.event.CLEventPublisher : reloadEventDefinitions

reloadEventDefinitions
Method
Purpose
This method stops all started event publishers, reloads event definitions from the configuration file and starts all valid event publishers with an auto start. You can make changes in the configuration file and reflect changes without restarting the TIBCO Hawk Agent.
Type
Synchronous, IMPACT_ACTION.
Arguments
None.
Returns
None.
Event Definitions XSD details
(plugin/commonlogging/ eventdefs.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://xsd.tns.tibco.com/hawk/cleventpublisher/eventdef" elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:eventdef="http://xsd.tns.tibco.com/hawk/cleventpublisher/eventdef">
 
<xsd:annotation>
<xsd:documentation>Provide details of Event Publisher</xsd:documentation>
</xsd:annotation>
<xsd:complexType name="EventSourceType">
<xsd:attribute name="id" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="methodName" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="microAgentName" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="EventDataSourceType">
<xsd:sequence>
<xsd:element name="EventSource" type="eventdef:EventSourceType" minOccurs="1" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="EventDefinitionsType">
<xsd:sequence>
<xsd:element name="EventPublishers" type="eventdef:EventPublishersType" minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="EventDataSource" type="eventdef:EventDataSourceType" minOccurs="1" maxOccurs="1"></xsd:element>
<xsd:element name="CommonLoggingConfigs" type="eventdef:CommonLoggingConfigsType" minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="EventPublisherType">
<xsd:sequence>
<xsd:element name="CommonLoggingConfigRef"
type="eventdef:CommonLoggingConfigRefType" minOccurs="1"
maxOccurs="1">
</xsd:element>
<xsd:element name="EventDataSourceRef"
type="eventdef:EventDataSourceRefType" minOccurs="1"
maxOccurs="1">
</xsd:element>
<xsd:element name="EventOutput"
type="eventdef:EventOutputType" minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="EventSubscribe"
type="eventdef:EventSubscribeType" minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="validateAtStartup" type="xsd:boolean" use="optional" default="false"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="CommonLoggingConfigType">
<xsd:annotation>
<xsd:documentation>Common Logging details.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="ExtendedModel" type="eventdef:ExtendedModelType" minOccurs="1" maxOccurs="1"></xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="loggerName" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
 
<xsd:element name="EventDefinitions" type="eventdef:EventDefinitionsType"></xsd:element>
 
<xsd:complexType name="EventDataSourceRefType">
<xsd:sequence>
<xsd:element name="EventSourceRef" type="eventdef:EventSourceRefType" minOccurs="1" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="EventSourceRefType">
<xsd:sequence>
<xsd:element name="InputParameters" type="eventdef:InputParametersType" minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element name="EventCorrelation" type="eventdef:EventCorrelationType" minOccurs="0" maxOccurs="1"></xsd:element>
</xsd:sequence>
<xsd:attribute name="ref" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="InputParametersType">
<xsd:sequence>
<xsd:element name="InputParameter" type="eventdef:InputParameterType" minOccurs="1" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="InputParameterType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
 
<xsd:complexType name="EventOutputType">
<xsd:sequence>
<xsd:element name="EventElements" type="eventdef:EventElementsType" minOccurs="1" maxOccurs="1"></xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="EventElementsType">
<xsd:choice>
<xsd:element name="EventElement"
type="eventdef:EventElementType" minOccurs="0"
maxOccurs="unbounded">
</xsd:element>
<xsd:element name="eventSourceRefs" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
</xsd:choice>
</xsd:complexType>
 
<xsd:complexType name="EventElementType">
<xsd:attribute name="source" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="output" type="xsd:string" use="optional"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="EventSubscribeType">
<xsd:sequence>
<xsd:element name="IntervalTime" type="xsd:int"
minOccurs="0" maxOccurs="1" nillable="false">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="sourceEventId" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="autoStart" type="xsd:boolean" use="optional" default="false"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="FilterType">
<xsd:attribute name="identifier" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="operator" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="="></xsd:enumeration>
<xsd:enumeration value="&gt;"></xsd:enumeration>
<xsd:enumeration value="&lt;"></xsd:enumeration>
<xsd:enumeration value="=&gt;"></xsd:enumeration>
<xsd:enumeration value="&lt;="></xsd:enumeration>
<xsd:enumeration value="!="></xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="LoggerType">
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="configFile" type="xsd:string" use="optional"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="ExtendedModelType">
<xsd:sequence>
<xsd:element name="Classpath" type="eventdef:ClasspathType" minOccurs="0" maxOccurs="1"></xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="packageName" type="xsd:string"
use="required">
</xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="EventPublishersType">
<xsd:sequence>
<xsd:element name="EventPublisher" type="eventdef:EventPublisherType" minOccurs="1" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="CommonLoggingConfigsType">
<xsd:sequence>
<xsd:element name="CommonLoggingConfig" type="eventdef:CommonLoggingConfigType" minOccurs="1" maxOccurs="unbounded">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="logConfigFile" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="CommonLoggingConfigRefType">
<xsd:attribute name="ref" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
 
<xsd:complexType name="EventCorrelationType">
<xsd:annotation>
<xsd:documentation>To correlate with other Event Data Source
</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="returnElement" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation>Return Element of Hawk MicroAgent Method
</xsd:documentation>
</xsd:annotation></xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
 
<xsd:complexType name="ClasspathType">
<xsd:sequence>
<xsd:element name="path" type="xsd:string" minOccurs="1" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Sample Event Definitions Configuration to CLEvents from Hawk
Following is the sample Event Definitions configuration to publish JVM Info Event of AMX 3 TIBCO Host Instance and Process Info Event of AMX 3 TIBCO Host instance and all nodes associated with this Host Instance. (plugin\commonlogging\ JVMAndProcessInfoEventdefs.xml)
<?xml version="1.0" encoding="UTF-8"?>
<def:EventDefinitions xmlns:def="http://xsd.tns.tibco.com/hawk/cleventpublisher/eventdef"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xsd.tns.tibco.com/hawk/cleventpublisher/eventdef eventdefs.xsd ">
<!-- Event Publishers Definition for
1. TIBCO Host JVM Process Info
2. Process Events for TIBCO Host and AMX Nodes running in local Machine. -->
<!-- Event Publishers Details -->
<def:EventPublishers>
 
<!--Sample Event Publisher to Publish Process Info Event for TIBCO AMX Host -->
<def:EventPublisher name="AMXHostProcessInfoEventPublisher">
 
<!-- Common Logging Configuration Details -->
<def:CommonLoggingConfigRef ref="ProcessCLConfig" />
 
<!--Event Data Source Ref -->
<def:EventDataSourceRef>
<def:EventSourceRef ref="AMXHost"/>
<def:EventSourceRef ref="Process">
<def:EventCorrelation returnElement="ID Process">${AMXHost.Process Id}</def:EventCorrelation>
</def:EventSourceRef>
</def:EventDataSourceRef>
 
<!-- Event Ouput -->
<def:EventOutput>
<def:EventElements>
<def:EventElement source="${Process.ID Process}" output="processId" />
<def:EventElement source="${Process.Process Name}" output="processName" />
<def:EventElement source="${Process.User Name}" output="userName" />
<def:EventElement source="${Process.CPU Time}" output="processCpuTime" />
<!-- On Windows platform Virtual KBytes,Stack KBytes,Heap KBytes, % CPU and % Memory not available-->
<def:EventElement source="${Process.Virtual KBytes}" output="virtualMemory" />
<def:EventElement source="${Process.Stack KBytes}" output="stackSize" />
<def:EventElement source="${Process.Heap KBytes}" output="heapSize" />
<def:EventElement source="${Process.% CPU}" output="cpuUsageInPercent" />
<def:EventElement source="${Process.% Memory}" output="memoryUsageInPercent" />
<def:EventElement source="${Process.Start time}" output="startTime" />
<def:EventElement source="${AMXHost.Name}" output="physicalCompId.matrix.host" />
</def:EventElements>
</def:EventOutput>
 
<!-- Event Subscription Details -->
<def:EventSubscribe sourceEventId="AMXHost" autoStart="false">
<def:IntervalTime>10000</def:IntervalTime>
</def:EventSubscribe>
</def:EventPublisher>
<!--TIBCO Host JVM InfoEvent Publisher -->
<def:EventPublisher name="AMXHostJVMInfoEventPublisher">
<def:CommonLoggingConfigRef ref="JVMnfoEventCLConfig" />
 
<def:EventDataSourceRef>
<def:EventSourceRef ref="AMXHost"/>
<def:EventSourceRef ref="JVMInfo">
<def:EventCorrelation returnElement="Process Id">${AMXHost.Process Id}</def:EventCorrelation>
</def:EventSourceRef>
</def:EventDataSourceRef>
 
<def:EventOutput>
<def:EventElements>
<def:EventElement source="${AMXHost.Name}" output="physicalCompId.matrix.host" />
<def:EventElement source="${JVMInfo.Maximum Heap Size}" output="maxMemory" />
<def:EventElement source="${JVMInfo.Committed Memory}" output="totalMemory" />
<def:EventElement source="${JVMInfo.Free Heap Size}" output="freeMemory" />
<def:EventElement source="${JVMInfo.Non Heap Memory Used}" output="nonHeapMemoryInUse" />
<def:EventElement source="${JVMInfo.Start Time}" output="startTime" />
<def:EventElement source="${JVMInfo.Up Time}" output="uptime" />
<def:EventElement source="${JVMInfo.Live Threads}" output="threadCount" />
<def:EventElement source="${JVMInfo.Daemon Threads}" output="daemonThreadCount" />
<def:EventElement source="${JVMInfo.Peak Threads}" output="peakThreadCount" />
</def:EventElements>
</def:EventOutput>
 
<def:EventSubscribe sourceEventId="AMXHost" autoStart="false">
<def:IntervalTime>10000</def:IntervalTime>
</def:EventSubscribe>
</def:EventPublisher>
 
<!--AMX Node(s) ProcessEventInfo Publisher -->
<def:EventPublisher name="AMXNodeProcessInfoEventPublisher">
 
<def:CommonLoggingConfigRef ref="ProcessCLConfig" />
 
<def:EventDataSourceRef>
<def:EventSourceRef ref="AMXNodeInfo">
<def:InputParameters>
<def:InputParameter name="Node Name"></def:InputParameter>
</def:InputParameters>
</def:EventSourceRef>
<def:EventSourceRef ref="Process">
<def:EventCorrelation returnElement="ID Process">${AMXNodeInfo.Process Id}</def:EventCorrelation>
</def:EventSourceRef>
</def:EventDataSourceRef>
 
<def:EventOutput>
<def:EventElements>
<def:EventElement source="${Process.ID Process}" output="processId" />
<def:EventElement source="${Process.Process Name}" output="processName" />
<def:EventElement source="${Process.User Name}" output="userName" />
<def:EventElement source="${Process.CPU Time}" output="processCpuTime" />
<!-- On Windows platform Virtual KBytes,Stack KBytes,Heap KBytes, % CPU and % Memory not available-->
<def:EventElement source="${Process.Virtual KBytes}" output="virtualMemory" />
<def:EventElement source="${Process.Stack KBytes}" output="stackSize" />
<def:EventElement source="${Process.Heap KBytes}" output="heapSize" />
<def:EventElement source="${Process.% CPU}" output="cpuUsageInPercent" />
<def:EventElement source="${Process.% Memory}" output="memoryUsageInPercent" />
<def:EventElement source="${Process.Start time}" output="startTime" />
<def:EventElement source="${AMXNodeInfo.Name}" output="physicalCompId.matrix.node" />
</def:EventElements>
</def:EventOutput>
 
<def:EventSubscribe sourceEventId="AMXNodeInfo" autoStart="false">
<def:IntervalTime>10000</def:IntervalTime>
</def:EventSubscribe>
</def:EventPublisher>
 
</def:EventPublishers>
 
 
<!-- Event Data Source Details -->
<def:EventDataSource>
<def:EventSource id="Process" methodName="getProcess" microAgentName="COM.TIBCO.hawk.hma.Process" />
<def:EventSource id="AMXHost" methodName="getHostInfo" microAgentName="com.tibco.hawk.amx.AMXHost" />
<def:EventSource id="AMXNodeInfo" methodName="getNodeInfo" microAgentName="com.tibco.hawk.amx.AMXHost" />
<def:EventSource id="JVMInfo" methodName="getVirtualMachineInfo" microAgentName="com.tibco.hawk.jvm.JavaVirtualMachine" />
</def:EventDataSource>
 
<!-- Common Logging Configuration -->
<def:CommonLoggingConfigs logConfigFile="%TIBCO_HAWK_HOME_ESC%/plugin/commonlogging/sample_log4j.xml">
 
<def:CommonLoggingConfig id="ProcessCLConfig" loggerName="hawk.clevent.logger">
<def:ExtendedModel packageName="com.tibco.governance.cl.extension.model.process.impl.ProcessInfoEventPackageImpl"
name="com.tibco.governance.cl.extension.model.process.impl.ProcessInfoEventImpl" />
</def:CommonLoggingConfig>
 
<def:CommonLoggingConfig id="JVMnfoEventCLConfig" loggerName="hawk.clevent.logger">
<def:ExtendedModel packageName="com.tibco.governance.jvminfo.model.jvminfoevent.impl.JvminfoeventPackageImpl"
name="com.tibco.governance.jvminfo.model.jvminfoevent.impl.JVMInfoEventImpl">
<def:Classpath>
<def:path>%TIBCO_COMPONENT_STORE_PLUGINS%/com.tibco.governance.jvminfo.model_1.0.0.004.jar</def:path>
<def:path>%TIBCO_COMPONENT_STORE_PLUGINS%/com.tibco.governance.commonlogging.extension.jvminfo.client_1.0.0.004.jar</def:path>
</def:Classpath>
</def:ExtendedModel>
</def:CommonLoggingConfig>
</def:CommonLoggingConfigs>
 
</def:EventDefinitions>
Sample Common Logging Configuration file
(plugin/commonlogging/sample_log4j.xml)
 
<?xml version="1.0" encoding="UTF-8"?>
<main_configuration>
<base_hierarchy>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CommonLoggingJMSAppender" class="com.tibco.commonlogging.appender.BEFJMSAppender">
<param name="serverUrl" value="tcp://localhost:7222" />
<param name="queueName" value="amx.governance.stats" />
<param name="userName" value="admin" />
<param name="password" value="" />
<param name="type" value="direct" />
</appender>
<logger name="hawk.clevent.logger" additivity="false">
<appender-ref ref="CommonLoggingJMSAppender"/>
</logger>
<logger name="root" additivity="false">
<level value="INFO" />
<appender-ref ref="CommonLoggingJMSAppender" />
</logger>
 
</log4j:configuration>
</base_hierarchy>
</main_configuration>
Refer to plugin/commonlogging folder for configuration details.

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