Sample Event Definitions Configuration to CLEvents from Hawk

The JVMAndProcessInfoEventdefs.xml is the sample Event Definitions configuration to publish the JVM Info and Process Info event of the AMX 3 TIBCO Host instance, and all nodes associated with this Host Instance.

File: <HAWK_HOME>\plugin\commonlogging\JVMAndProcessInfoEventdefs.xml.

Content:

<?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

File: <HAWK_HOME>/plugin/commonlogging/sample_log4j.xml

Content:

<?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 the <HAWK_HOME>/plugin/commonlogging folder for configuration details.