TN3270 Service Discovery

Microsoft.HostIntegrationServer.2010.TN3270Discovery (Discovery)

Checks Opt-Out registry keys
Checks for Display sessions assigned to the TN3270 service

Knowledge Base article:

Summary

The TN3270 Service discovery checks the registry location "HKLM\SOFTWARE\Microsoft\ SNA Server\CurrentVersion\Monitoring\" for the existence of the “Opt-Out” key DisableTN3270Monitoring. If the key exists, no further action is taken. If the key does not exist, the Host Integration Server 2010 Management Pack queries the WMI namespace “root\MicrosoftHIS”, looking for TN3270 sessions defined on the server. If any sessions are found, the Host Integration Server 2010 Management Pack creates an instance of the TN3270 class.

Element properties:

TargetMicrosoft.HostIntegrationServer.2010.SNAGateway
EnabledTrue
Frequency43245
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Default

Source Code:

<Discovery ID="Microsoft.HostIntegrationServer.2010.TN3270Discovery" Enabled="true" Target="Microsoft.HostIntegrationServer.2010.SNAGateway" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.HostIntegrationServer.2010.TN3270">
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="Microsoft.HostIntegrationServer.2010.TN3270" PropertyID="TN3270Sessions"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>43245</IntervalSeconds>
<SyncTime/>
<ScriptName>HIS2010 TN3270Service Discovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>
'--------------------------------------------------------------------------------------------------
' &lt;name&gt;HIS2010 TN3270Service Discovery.vbs&lt;/name&gt;
' &lt;company&gt;Microsoft Corporation&lt;/company&gt;
' &lt;copyright&gt;Copyright (c) Microsoft Corporation 2010&lt;/copyright&gt;
' &lt;summary&gt;
' Microsoft Host Integration Server 2010 TN3270 service discovery script for use with SCOM 2007.
' Provides discovery functions for HIS TN3270.
' &lt;/summary&gt;
'
' See Management Pack Guide for details on parameters and usage
'--------------------------------------------------------------------------------------------------

SetLocale("en-us")
Dim oAPI, oDiscoveryData, oInst
Set oAPI = CreateObject("MOM.ScriptAPI")

Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count &lt; 3 Then
Wscript.Quit -1
End If

Dim SourceID, ManagedEntityId, TargetComputer

SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)

set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)

Dim strNetbiosName
strNetbiosName = "$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/NetbiosComputerName$"

Dim intTN3Sessions
intTN3Sessions = 0

Dim bDisableTN3Monitoring, bDisableTN5Monitoring, bDisablePrintMonitoring, bDisableHIPMonitoring, bDisableLU62ResyncMonitoring, bDisableIPResyncMonitoring
Dim bDisableSIMonitoring, bDisableMIMonitoring, bDisableDIMonitoring, bDisableWIPMonitoring

bDisableTN3Monitoring = FALSE
bDisableTN5Monitoring = FALSE
bDisablePrintMonitoring = FALSE
bDisableHIPMonitoring = FALSE
bDisableLU62ResyncMonitoring = FALSE
bDisableIPResyncMonitoring = FALSE
bDisableSIMonitoring = FALSE
bDisableMIMonitoring = FALSE
bDisableDIMonitoring = FALSE
bDisableWIPMonitoring = FALSE

Dim Locator, Service
Set Locator = CreateObject("WbemScripting.SWbemLocator")

GetRegParams()
TN3270SvcsDiscovery()

call oAPI.Return(oDiscoveryData)

Sub GetRegParams()

' Performs all registry lookups required for service discovery.

Const WMI_REG_HKLM = &amp;H80000002

Const HIS_OPTOUT_KEYPATH = "SOFTWARE\Microsoft\SNA Server\CurrentVersion\Monitoring\"
Const HIS_TN3_OPTOUT_KEY = "DisableTN3270Monitoring"
Const HIS_TN5_OPTOUT_KEY = "DisableTN5250Monitoring"
Const HIS_PRINT_OPTOUT_KEY = "DisablePrintMonitoring"
Const HIS_HIP_OPTOUT_KEY = "DisableHIPMonitoring"
Const HIS_LU62RESYNC_OPTOUT_KEY = "DisableLU62ResyncMonitoring"
Const HIS_IPRESYNC_OPTOUT_KEY = "DisableIPResyncMonitoring"
Const HIS_SI_OPTOUT_KEY = "DisableSessionIntegratorMonitoring"
Const HIS_DI_OPTOUT_KEY = "DisableDataIntegrationMonitoring"
Const HIS_MI_OPTOUT_KEY = "DisableMessageIntegrationMonitoring"
Const HIS_WIP_OPTOUT_KEY = "DisableWIPMonitoring"

Const HIS_SNA_CONFIG_KEYPATH = "SOFTWARE\Microsoft\Host Integration Server\ConfigFramework\ConfiguredFeatures"
Const HIS_SNA_SERVICE_KEY = "SNA_SERVICE"
Const HIS_SNA_APPLICATION_SUPPORT_KEY = "SNA_APPLICATION_SUPPORT"

Dim oRegProvider
Dim intReturn
Dim colValues, strValue
Dim colTypes

' =============================================================
' Check for the possible set of monitoring opt-out keys, and for each that exists
' set the corresponding boolean variable to TRUE

set oRegProvider=GetObject("winmgmts:\\" &amp; TargetComputer &amp; "\root\default:StdRegProv")

intReturn = oRegProvider.EnumValues (WMI_REG_HKLM, HIS_OPTOUT_KEYPATH, colValues, colTypes)

if intReturn = 0 AND NOT(IsNull(colValues)) then

for each strValue in colValues

Select Case strValue

Case HIS_TN3_OPTOUT_KEY
bDisableTN3Monitoring = TRUE

Case HIS_TN5_OPTOUT_KEY
bDisableTN5Monitoring = TRUE

Case HIS_PRINT_OPTOUT_KEY
bDisablePrintMonitoring = TRUE

Case HIS_HIP_OPTOUT_KEY
bDisableHIPMonitoring = TRUE

Case HIS_LU62RESYNC_OPTOUT_KEY
bDisableLU62ResyncMonitoring = TRUE

Case HIS_IPRESYNC_OPTOUT_KEY
bDisableIPResyncMonitoring = TRUE

Case HIS_SI_OPTOUT_KEY
bDisableSIMonitoring = TRUE

Case HIS_MI_OPTOUT_KEY
bDisableMIMonitoring = TRUE

Case HIS_DI_OPTOUT_KEY
bDisableDIMonitoring = TRUE

Case HIS_WIP_OPTOUT_KEY
bDisableWIPMonitoring = TRUE

End Select
next
end if

End Sub 'GetRegParams


Sub TN3270SvcsDiscovery()

' SNA Svcs discovery - TN3
' All state components within a role must be discovered within a single discovery data instance.

Dim colSessions
Dim colWin32Services
Dim objWin32Service

' TN3270 Discovery
' Get the set of TN3270 sessions for this HIS server, and if &gt; 0 add the
' TN3 state monitoring component in the HIS Svcs role.

if NOT bDisableTN3Monitoring then

Set Service = Locator.ConnectServer(TargetComputer, "root\MicrosoftHIS")

' Get TN3270 session count
set colSessions = Service.ExecQuery("select * FROM MsSna_TN3270Session where Service='" &amp; strNetbiosName &amp; "'",, 0)

if NOT colSessions.Count = 0 then
intTN3Sessions = colSessions.Count
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.HostIntegrationServer.2010.TN3270']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='Microsoft.HostIntegrationServer.2010.TN3270']/TN3270Sessions$", intTN3Sessions)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "TN3270")
call oDiscoveryData.AddInstance(oInst)
end if
end if

End Sub 'TN3270SvcsDiscovery
</Script></ScriptBody>
<TimeoutSeconds>360</TimeoutSeconds>
</DataSource>
</Discovery>