EVA DiskGroup Discovery DataSource

EVA.DiskGroup.Discovery.DataSource (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

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

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
TimeoutSecondsint$Config/TimeoutSeconds$

Source Code:

<DataSourceModuleType ID="EVA.DiskGroup.Discovery.DataSource" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element minOccurs="1" name="ComputerName" type="xsd:string"/>
<xsd:element minOccurs="1" name="EvaperfPath" type="xsd:string"/>
<xsd:element minOccurs="1" name="EvaName" type="xsd:string"/>
<xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element minOccurs="1" name="SyncTime" type="xsd:string"/>
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="MicrosoftWindowsLibrary6062780!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
<ScriptName>HP_EVA_DiskGroup_Discovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Config/ComputerName$ "$Config/EvaperfPath$" $Config/EvaName$</Arguments>
<ScriptBody><Script><![CDATA[
' Discovers HP EVA
'
' command: evaperf ls -csv
'
SetLocale("en-us")
Dim oArgs
Set oArgs = WScript.Arguments

if oArgs.Count < 3 Then
Wscript.Quit -1
End If

Dim SourceID, ManagedEntityId, TargetComputer

SourceId = oArgs(0) ' The GUID of the discovery object that launched the script.
ManagedEntityId = oArgs(1) ' The GUID of the computer class targeted by the script.
TargetComputer = oArgs(2) ' The FQDN of the computer targeted by the script.
Evaperf_Path = oArgs(3)
EVAName = oArgs(4)


Set WshShell = CreateObject("WScript.Shell")

StrCommand = "CMD /c " & Chr(34) & Evaperf_Path & "\evaperf.exe" & Chr(34) & " vdg -csv > c:\temp\EVAPERF_EVA_Disk_Group_Discovery_" & EVAName & ".csv"

WshShell.Run strcommand,,True

'For Debug Only. DO NOT USE
'StrCommand = "CMD /c " & "echo " & SourceId & " " & ManagedEntityId & " " & TargetComputer & " > c:\temp\EVAPERF_EVA_Disk_Group_Discovery" & EVAName & ".out"
'wscript.echo strcommand
'WshShell.Run strcommand,,True


linenumber=0
FileName = "c:\temp\EVAPERF_EVA_Disk_Group_Discovery_" & EVAName & ".csv"
Set fso = CreateObject("Scripting.FileSystemObject")

Const ForReading = 1

If fso.FileExists(FileName) = 0 Then
wscript.echo "File not found."
wscript.quit
End If

Set oAPI = CreateObject("MOM.ScriptAPI")
Dim oDiscoveryData, oInst
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)

Set oFile = fso.GetFile(FileName)

Set oStream = oFile.OpenAsTextStream(ForReading, TristateUseDefault)

Name = ""

Do While Not oStream.AtEndOfStream
sRecord=oStream.ReadLine
if linenumber <> 0 and sRecord <> "" Then
tmp = split(sRecord,",")
if StrComp(tmp(1) & ":" & tmp(14) & ":" & tmp(15),Name) <> 0 Then
Name = tmp(1) & ":" & tmp(14) & ":" & tmp(15)
InstanceName = tmp(15) & " - " & tmp(1)
if StrComp(tmp(15),EVAName) = 0 Then

Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='EVA.Disk.Group']$")

Call oInst.AddProperty("$MPElement[Name='MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
Call oInst.AddProperty("$MPElement[Name='EVAPerformanceMonitor']/Name$", "Evaperf")
Call oInst.AddProperty("$MPElement[Name='EVA']/EVAName$", EVAName)
Call oInst.AddProperty("$MPElement[Name='EVA.Disk.Group']/DiskGroupName$", Name)
Call oInst.AddProperty("$MPElement[Name='EVA.Disk.Group']/InstanceName$", InstanceName)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", Name)

Call oDiscoveryData.AddInstance(oInst)
End If

End If

End If
linenumber = linenumber+1
Loop
oStream.Close

Call oAPI.Return(oDiscoveryData)

]]></Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>