HIS 2006 Tracing

HIS_2006_Tracing.NoHost (WriteActionModuleType)

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData
Comment{B39FF836-B107-44AB-ABA3-6B097E916DF3}

Member Modules:

ID Module Type TypeId RunAs 
RunScriptAction WriteAction System.Mom.BackwardCompatibility.NoHost.ScriptResponse Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
Actionstring$Config/Parameters/Action$ActionControls what tracing action the script performs, START or STOP
Componentstring$Config/Parameters/Component$ComponentControls for which HIS components tracing is enabled/disabled. ALL enables/disables tracing for all components. MANUAL enables/disables tracing per the parameter settings for individual components. EVENT enables/disables tracing for the component specified in the event or alert that triggered the script. If ALL or EVENT are specified the parameter settings for individual components are ignored.
SNABasestring$Config/Parameters/SNABase$SNABaseIf Component=MANUAL, controls if tracing is enabled/disabled for the SNABase component
SNALU62Resyncstring$Config/Parameters/SNALU62Resync$SNALU62ResyncIf Component=MANUAL, controls if tracing is enabled/disabled for the SNALU62Resync component
SNAManageAgentstring$Config/Parameters/SNAManageAgent$SNAManageAgentIf Component=MANUAL, controls if tracing is enabled/disabled for the SNAManageAgent component
SNAManageClientstring$Config/Parameters/SNAManageClient$SNAManageClientIf Component=MANUAL, controls if tracing is enabled/disabled for the SNAManageClient component
SNAManagementstring$Config/Parameters/SNAManagement$SNAManagementIf Component=MANUAL, controls if tracing is enabled/disabled for the SNAManagement component
SNAPrintstring$Config/Parameters/SNAPrint$SNAPrintIf Component=MANUAL, controls if tracing is enabled/disabled for the SNAPrint component
SNAServerstring$Config/Parameters/SNAServer$SNAServerIf Component=MANUAL, controls if tracing is enabled/disabled for the SNAServer component
TN3270string$Config/Parameters/TN3270$TN3270If Component=MANUAL, controls if tracing is enabled/disabled for the TN3270 component
TN5250string$Config/Parameters/TN5250$TN5250If Component=MANUAL, controls if tracing is enabled/disabled for the TN5250 component
TraceMaskstring$Config/Parameters/TraceMask$TraceMaskControls which internal trace types are enabled/disabled. Specify ALL or any combination of FATAL, ERROR, DEBUG, STATE, FUNCTION, and CUSTOM.

Source Code:

<WriteActionModuleType ID="HIS_2006_Tracing.NoHost" Accessibility="Internal" Comment="{B39FF836-B107-44AB-ABA3-6B097E916DF3}">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>MomBackwardCompatibility!System.Mom.BackwardCompatibility.AlertGenerationSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AlertGeneration" type="AlertGenerationType"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="InvokerType" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Parameters" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Action" type="xsd:string" minOccurs="0"/>
<xsd:element name="Component" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNABase" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNALU62Resync" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNAManageAgent" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNAManageClient" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNAManagement" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNAPrint" type="xsd:string" minOccurs="0"/>
<xsd:element name="SNAServer" type="xsd:string" minOccurs="0"/>
<xsd:element name="TN3270" type="xsd:string" minOccurs="0"/>
<xsd:element name="TN5250" type="xsd:string" minOccurs="0"/>
<xsd:element name="TraceMask" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="Action" Selector="$Config/Parameters/Action$" ParameterType="string"/>
<OverrideableParameter ID="Component" Selector="$Config/Parameters/Component$" ParameterType="string"/>
<OverrideableParameter ID="SNABase" Selector="$Config/Parameters/SNABase$" ParameterType="string"/>
<OverrideableParameter ID="SNALU62Resync" Selector="$Config/Parameters/SNALU62Resync$" ParameterType="string"/>
<OverrideableParameter ID="SNAManageAgent" Selector="$Config/Parameters/SNAManageAgent$" ParameterType="string"/>
<OverrideableParameter ID="SNAManageClient" Selector="$Config/Parameters/SNAManageClient$" ParameterType="string"/>
<OverrideableParameter ID="SNAManagement" Selector="$Config/Parameters/SNAManagement$" ParameterType="string"/>
<OverrideableParameter ID="SNAPrint" Selector="$Config/Parameters/SNAPrint$" ParameterType="string"/>
<OverrideableParameter ID="SNAServer" Selector="$Config/Parameters/SNAServer$" ParameterType="string"/>
<OverrideableParameter ID="TN3270" Selector="$Config/Parameters/TN3270$" ParameterType="string"/>
<OverrideableParameter ID="TN5250" Selector="$Config/Parameters/TN5250$" ParameterType="string"/>
<OverrideableParameter ID="TraceMask" Selector="$Config/Parameters/TraceMask$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<WriteAction ID="RunScriptAction" TypeID="MomBackwardCompatibility!System.Mom.BackwardCompatibility.NoHost.ScriptResponse">
<AlertGeneration>$Config/AlertGeneration$</AlertGeneration>
<InvokerType>$Config/InvokerType$</InvokerType>
<Body><Script>
'--------------------------------------------------------------------------------------------------
' &lt;name&gt;HIS 2006 Tracing.vbs&lt;/name&gt;
' &lt;company&gt;Microsoft Corporation&lt;/company&gt;
' &lt;copyright&gt;Copyright (c) Microsoft Corporation 2006&lt;/copyright&gt;
' &lt;summary&gt;
' Microsoft Host Integration Server 2006 tracing start / stop script for use with MOM 2005
' &lt;/summary&gt;
'
' See Management Pack Guide for details on parameters and usage
'--------------------------------------------------------------------------------------------------

Option Explicit

Dim strIndent, strIndent2, strIndent3
Dim bOption, bSNABase, bSNAManagement, bSNAManageClient, bSNAManageAgent, bSNAPrint, bSNAServer, bSNALU62Resync, bTN3270, bTN5250
Dim intTraceMask
Dim strOutput, strAction, strComponent, strMask, strSource
Dim objParameters, objEvent, objAlert
Dim Service, Locator
Dim objHISTraceInst, objNewPath

strIndent=" "
strIndent2=strIndent &amp; strIndent
strIndent3=strIndent2 &amp; strIndent

CONST HIS_TRACE_NONE = 0
CONST HIS_TRACE_FATAL = 1
CONST HIS_TRACE_ERROR = 2
CONST HIS_TRACE_DEBUG = 4
CONST HIS_TRACE_STATE = 8
CONST HIS_TRACE_FUNC = 16
CONST HIS_TRACE_CUSTOM = 64
CONST HIS_TRACE_ALL = 95

bSNABase = False
bSNAManagement = False
bSNAManageClient = False
bSNAManageAgent = False
bSNAPrint = False
bSNAServer = False
bSNALU62Resync = False
bTN3270 = False
bTN5250 = False

Sub Main()

ScriptContext.Echo("Starting HIS Tracing start/stop")

' Get script parameters
set objParameters = ScriptContext.Parameters
strAction = UCase(objParameters.get("Action"))
strMask = UCase(objParameters.get("TraceMask"))
strComponent = Ucase(objParameters.get("Component"))

ScriptContext.Echo(strIndent &amp; "Action: " &amp; strAction)
ScriptContext.Echo(strIndent &amp; "TraceMask: " &amp; strMask)

' Determine script action - start or stop tracing. bOption is
' used to enable/diable the tracing options for each component
' that are not controlled by the trace mask.

if strAction = "STOP" then

bOption = False

elseif strAction = "START" then

bOption = True

else

ScriptContext.Echo(strIndent &amp; "Invalid Action parameter. Valid options are START and STOP.")

end if

' Determine the trace mask to use in enabling tracing. If this is a STOP action
' then set trace mask to none (tracing off), otherwise check value and if necessary parse
' parameters to build trace mask.

if strAction = "STOP" then

intTraceMask = HIS_TRACE_NONE

else

if (strMask="" OR strMask = "ALL") then

intTraceMask=HIS_TRACE_ALL

else

if InStr(strMask,"FATAL") &lt;&gt; 0 then intTraceMask = intTraceMask + HIS_TRACE_FATAL
if InStr(strMask,"ERROR") &lt;&gt; 0 then intTraceMask = intTraceMask + HIS_TRACE_ERROR
if InStr(strMask,"DEBUG") &lt;&gt; 0 then intTraceMask = intTraceMask + HIS_TRACE_DEBUG
if InStr(strMask,"STATE") &lt;&gt; 0 then intTraceMask = intTraceMask + HIS_TRACE_STATE
if InStr(strMask,"FUNCTION") &lt;&gt; 0 then intTraceMask = intTraceMask + HIS_TRACE_FUNC
if InStr(strMask,"CUSTOM") &lt;&gt; 0 then intTraceMask = intTraceMask + HIS_TRACE_CUSTOM

end if

end if

' Determine which components to update. Based on parameters set a boolean variable
' for each component, which is referenced when updating the WMI classes. If Component
' parameter = EVENT, get the event/alert that triggered the script and the associated source
' value, and then match that to the appropriate WMI tracing class. If Component parameter = MANUAL,
' get and evaluate the parameters for individual components. If Component parameter = ALL, set
' all components for update.

ScriptContext.Echo(strIndent &amp; "Component: " &amp; strComponent)

' EVENT
if strComponent = "EVENT" then

if ScriptContext.IsEvent() then

set objEvent=ScriptContext.Event
strSource = UCase(objEvent.EventSource)
ScriptContext.Echo(strIndent &amp; "Event source: " &amp; strSource)
MatchSource

elseif ScriptContext.IsAlert() then

set objAlert=ScriptContext.Alert
strSource = Ucase(objAlert.AlertSource)
ScriptContext.Echo(strIndent &amp; "Alert source: " &amp; strSource)
MatchSource

else

ScriptContext.Echo(strIndent &amp; "Not called by an event or alert, invalid Component setting.")

end if

' MANUAL
elseif strComponent = "MANUAL" then

bSNABase = CBool(objParameters.get("SNABase"))
bSNAManagement = CBool(objParameters.get("SNAManagement"))
bSNAManageClient = CBool(objParameters.get("SNAManageClient"))
bSNAManageAgent = CBool(objParameters.get("SNAManageAgent"))
bSNAServer = CBool(objParameters.get("SNAServer"))
bSNAPrint = CBool(objParameters.get("SNAPrint"))
bSNALU62Resync = CBool(objParameters.get("SNALU62Resync"))
bTN3270 = CBool(objParameters.get("TN3270"))
bTN5250 = CBool(objParameters.get("TN5250"))

ScriptContext.Echo(strIndent &amp; "SNABase: " &amp; bSNABase)
ScriptContext.Echo(strIndent &amp; "SNAManagement: " &amp; bSNAManagement)
ScriptContext.Echo(strIndent &amp; "SNAManageClient: " &amp; bSNAManageClient)
ScriptContext.Echo(strIndent &amp; "SNAManageAgent: " &amp; bSNAManageAgent)
ScriptContext.Echo(strIndent &amp; "SNAServer: " &amp; bSNAServer)
ScriptContext.Echo(strIndent &amp; "SNAPrint: " &amp; bSNAPrint)
ScriptContext.Echo(strIndent &amp; "SNALU62Resync: " &amp; bSNALU62Resync)
ScriptContext.Echo(strIndent &amp; "TN3270: " &amp; bTN3270)
ScriptContext.Echo(strIndent &amp; "TN5250: " &amp; bTN5250)

' ALL
elseif strComponent = "ALL" then

bSNABase = True
bSNAManagement = True
bSNAManageClient = True
bSNAManageAgent = True
bSNAPrint = True
bSNAServer = True
bSNALU62Resync = True
bTN3270 = True
bTN5250 = True

else

ScriptContext.Echo("Invalid Component setting. Valid options are ALL, EVENT, and MANUAL")

end if

' Update the necessary WMI tracing classes. For each supported tracing component,
' evaluate the associated boolean vlaue and if necessary get, update, and put the
' instance to perform the update. If Print, TN3, or TN5 are specified then SNABase
' and SNAServer are also always changed.

' Get connected to WMI.
' The second call returns a SWbemServices object ("Service")

Set Locator = CreateObject("WbemScripting.SWbemLocator")
if ScriptContext.isTargetAgentless then
Set Service = Locator.ConnectServer(ScriptContext.TargetNetBiosComputer, "root\MicrosoftHIS")
else
Set Service = Locator.ConnectServer(".", "root\MicrosoftHIS")
end if

' WMI class updates

' SNABase
if bSNABase or bSNAPrint or bTN3270 or bTN5250 or bSNALU62Resync then

set objHISTraceInst = Service.Get("MsHisTrace_SNABase=@")

objHISTraceInst.EnabledTraces=intTraceMask
objHISTraceInst.InternalMessageTrace=bOption
objHISTraceInst.T3270Trace=bOption
objHISTraceInst.LU62Trace=bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNABase"

end if

' SNAManagement
if bSNAManagement then

set objHISTraceInst = Service.Get("MsHisTrace_SNAServerManager=@")

objHISTraceInst.EnabledTraces=intTraceMask
objHISTraceInst.InternalMessageTrace=bOption
objHISTraceInst.T3270Trace=bOption
objHISTraceInst.LU62Trace=bOption
objHISTraceInst.APPCTrace = bOption
objHISTraceInst.CPICTrace = bOption
objHISTraceInst.CSVTrace = bOption
objHISTraceInst.LUATrace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNAManagement"

end if

' SNAServer
if bSNAServer or bSNAPrint or bTN3270 or bTN5250 or bSNALU62Resync then

set objHISTraceInst = Service.Get("MsHisTrace_SNAServer=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.DLCTrace = bOption
objHISTraceInst.InternalMessageTrace = bOption
objHISTraceInst.LU62Trace = bOption
objHISTraceInst.SnaTrace = bOption
objHISTraceInst.T3270Trace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNAServer"

end if

' SNAManageClient
if bSNAManageClient then

set objHISTraceInst = Service.Get("MsHisTrace_SNAManageClient=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.InternalMessageTrace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNAManageClient"

end if

' SNAManageAgent
if bSNAManageAgent then

set objHISTraceInst = Service.Get("MsHisTrace_SNAMngAgent=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.InternalMessageTrace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNAMngAgent"

end if

' SNAPrint
if bSNAPrint then

set objHISTraceInst = Service.Get("MsHisTrace_SNAPrint=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.APPCTrace = bOption
objHISTraceInst.CPICTrace = bOption
objHISTraceInst.CSVTrace = bOption
objHISTraceInst.InternalMessageTrace = bOption
objHISTraceInst.LU62Trace = bOption
objHISTraceInst.LUATrace = bOption
objHISTraceInst.T3270Trace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNAPrint"

end if

' SNALU62Resync
if bSNALU62Resync then

set objHISTraceInst = Service.Get("MsHisTrace_SNAApplication=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.InternalMessageTrace = bOption
objHISTraceInst.T3270Trace = bOption
objHISTraceInst.LU62Trace = bOption
objHISTraceInst.APPCTrace = bOption
objHISTraceInst.CPICTrace = bOption
objHISTraceInst.LUATrace = bOption
objHISTraceInst.CSVTrace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "SNALU62Resync"

end if

' TN3270
if bTN3270 then

set objHISTraceInst = Service.Get("MsHisTrace_TN3270=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.InternalMessageTrace = bOption
objHISTraceInst.LU62Trace = bOption
objHISTraceInst.T3270Trace = bOption
objHISTraceInst.APPCTrace = bOption
objHISTraceInst.CPICTrace = bOption
objHISTraceInst.LUATrace = bOption
objHISTraceInst.CSVTrace = bOption
objHISTraceInst.TraceState = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "TN3270"

end if

' TN5250
if bTN5250 then

set objHISTraceInst = Service.Get("MsHisTrace_TN5250=@")

objHISTraceInst.EnabledTraces = intTraceMask
objHISTraceInst.InternalMessageTrace = bOption
objHISTraceInst.LU62Trace = bOption
objHISTraceInst.T3270Trace = bOption
objHISTraceInst.APPCTrace = bOption
objHISTraceInst.CPICTrace = bOption
objHISTraceInst.LUATrace = bOption
objHISTraceInst.CSVTrace = bOption

set objNewPath = objHISTraceInst.Put_
CheckErr Err, "TN5250"

end if

ScriptContext.Echo("End HIS Tracing start/stop")

End Sub

Sub CheckErr(Err, strClass)

if Err = 0 then

ScriptContext.Echo(strIndent &amp; strClass &amp; " tracing changed")

else

ScriptContext.Echo(strIndent &amp; "Error changing " &amp; strClass &amp; " tracing. Error code: " &amp; Err)

end if

End Sub

Sub MatchSource()

Select Case strSource

Case "SNA BASE SERVICE"

bSNABase = True
ScriptContext.Echo(strIndent &amp; "SNABase: TRUE")
Exit Sub

Case "SNA MANAGE CLIENT"

bSNAManageClient = True
ScriptContext.Echo(strIndent &amp; "SNAManageClient: TRUE")
Exit Sub

Case "SNA MANAGE AGENT"

bSNAManageAgent = True
ScriptContext.Echo(strIndent &amp; "SNAManageAgent: TRUE")
Exit Sub

Case "SNA SERVER"

bSNAServer = True
ScriptContext.Echo(strIndent &amp; "SNAServer: TRUE")
Exit Sub

Case "SNA PRINT SERVER"

bSNAPrint = True
' Print should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent &amp; "SNAPrint: TRUE")
ScriptContext.Echo(strIndent &amp; "SNABase: TRUE")
ScriptContext.Echo(strIndent &amp; "SNAServer: TRUE")
Exit Sub

Case "TN3270 SERVER"

bTN3270 = True
' TN3 should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent &amp; "TN3270: TRUE")
ScriptContext.Echo(strIndent &amp; "SNABase: TRUE")
ScriptContext.Echo(strIndent &amp; "SNAServer: TRUE")
Exit Sub

Case "SNA TN5250 SERVER"

bTN5250 = True
' TN5 should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent &amp; "TN5250: TRUE")
ScriptContext.Echo(strIndent &amp; "SNABase: TRUE")
ScriptContext.Echo(strIndent &amp; "SNAServer: TRUE")
Exit Sub

Case "SNA LU6.2 RESYNC TP"
bSNALU62Resync = True
' LU resync should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent &amp; "SNALU62Resync: TRUE")
ScriptContext.Echo(strIndent &amp; "SNABase: TRUE")
ScriptContext.Echo(strIndent &amp; "SNAServer: TRUE")
Exit Sub

Case Else

' unknown or unsupported component
ScriptContext.Echo(strIndent &amp; strSource &amp; " is not a known component or does not support tracing. Tracing not enabled.")

End Select

End Sub</Script></Body>
<Language>VBScript</Language>
<Name>HIS 2006 Tracing</Name>
<Parameters>
<Parameter>
<Name>Action</Name>
<Value>$Config/Parameters/Action$</Value>
</Parameter>
<Parameter>
<Name>Component</Name>
<Value>$Config/Parameters/Component$</Value>
</Parameter>
<Parameter>
<Name>SNABase</Name>
<Value>$Config/Parameters/SNABase$</Value>
</Parameter>
<Parameter>
<Name>SNALU62Resync</Name>
<Value>$Config/Parameters/SNALU62Resync$</Value>
</Parameter>
<Parameter>
<Name>SNAManageAgent</Name>
<Value>$Config/Parameters/SNAManageAgent$</Value>
</Parameter>
<Parameter>
<Name>SNAManageClient</Name>
<Value>$Config/Parameters/SNAManageClient$</Value>
</Parameter>
<Parameter>
<Name>SNAManagement</Name>
<Value>$Config/Parameters/SNAManagement$</Value>
</Parameter>
<Parameter>
<Name>SNAPrint</Name>
<Value>$Config/Parameters/SNAPrint$</Value>
</Parameter>
<Parameter>
<Name>SNAServer</Name>
<Value>$Config/Parameters/SNAServer$</Value>
</Parameter>
<Parameter>
<Name>TN3270</Name>
<Value>$Config/Parameters/TN3270$</Value>
</Parameter>
<Parameter>
<Name>TN5250</Name>
<Value>$Config/Parameters/TN5250$</Value>
</Parameter>
<Parameter>
<Name>TraceMask</Name>
<Value>$Config/Parameters/TraceMask$</Value>
</Parameter>
</Parameters>
<ManagementPackId>[Microsoft.HostIntegrationServer.2006,,1.0.0.1]</ManagementPackId>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="RunScriptAction"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>SystemLibrary!System.BaseData</InputType>
</WriteActionModuleType>