LDAP 绑定时间脚本数据源
Microsoft.Windows.Server.2012.AD.Performance.BindTimes.DataSource (DataSourceModuleType)
LDAP 绑定时间监视器的数据源。
Element properties:
Member Modules:
Overrideable Parameters:
Source Code:
<DataSourceModuleType ID="Microsoft.Windows.Server.2012.AD.Performance.BindTimes.DataSource" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MonitorBindType" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="MonitorBindType" Selector="$Config/MonitorBindType$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<ApplicationName>%windir%\system32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>//nologo $file/LDAP_Bind_Time.vbs$ $Config/MonitorBindType$ </CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>LDAP_Bind_Time.vbs</Name>
<Contents><Script>'*************************************************************************
' Script Name - LDAP Bind Time
'
' Purpose - Monitors the bind times - SSL and non-SSL binds
'
' (c) Copyright 2014, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************
Option Explicit
SetLocale("en-us")
Sub Main()
Dim oAPI, oBag, oSysInfo, oParams, sDomain
Dim iBindType, dtStart, oRoot, iTime
Set oAPI = CreateObject("Mom.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set oParams = WScript.Arguments
if oParams.Count <> 1 then
iBindType = 1
Else
iBindType = CInt(oParams(0))
if iBindType > 3 or iBindType < 1 then
iBindType = 1
End if
End if
set oSysInfo = CreateObject("ADSystemInfo")
sDomain = oSysInfo.DomainDNSName
On Error Resume Next
' Bind using non-SSL
If iBindType = 3 or iBindType = 1 Then
dtStart = Now
set oRoot = GetObject("LDAP://" & sDomain & "/rootDSE")
iTime = DateDiff("s", dtStart, Now)
' Write the perf data
oBag.AddValue "StatusInstance", ""
oBag.AddValue "StatusValue", "" & iTime
oAPI.AddItem oBag
End If
' Bind using SSL
If iBindType = 3 or iBindType = 2 Then
dtStart = Now
set oRoot = GetObject("LDAP://" & sDomain & ":636/rootDSE")
iTime = DateDiff("s", dtStart, Now)
' Write the perf data
oBag.AddValue "StatusInstanceSSL", ""
oBag.AddValue "StatusValue", "" & iTime
oAPI.AddItem oBag
End If
oAPI.ReturnItems
End Sub
Call Main()
</Script></Contents>
<Unicode>1</Unicode>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>