Edge Server Discovery Module

Talon.FAST.Discovery.EdgeServer (Discovery)

Discovers all the Edge Servers in the TalonFAST Infrastructure.

Element properties:

TargetTalon.FAST.Seed
EnabledTrue
Frequency14400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

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

Source Code:

<Discovery ID="Talon.FAST.Discovery.EdgeServer" Target="Talon.FAST.Seed" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Talon.FAST.ComputerRole.EdgeServer"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>14400</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverEdges.ps1</ScriptName>
<ScriptBody><Script>#
# DiscoverEdges.ps1
#
param($sourceId, $managedEntityId, $computerName)

function Test-RegistryEntry ([string] $key, [string] $name)
{
Get-ItemProperty -Path "$key" -Name "$name" -ErrorAction SilentlyContinue | Out-Null;
return $?;
}

function Read-RegistryEntry ([string] $key, [string] $name)
{
if ( Test-RegistryEntry $key $name )
{
return (Get-ItemProperty -Path $key -Name $name).$name;
}
else
{
return '';
}
}


$api = New-Object -comObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0, $sourceId, $managedEntityId)

$result = Test-RegistryEntry 'HKLM:\Talon\tum\Client\SysId' 'Isclient'
if ($result)
{
$instance = $discoveryData.CreateClassInstance("$MPElement[Name='Talon.FAST.ComputerRole.EdgeServer']$")

$sysId = Read-RegistryEntry 'HKLM:\Talon\tum\Client\SysId' 'Sysid'
$expiry = Read-RegistryEntry 'HKLM:\SOFTWARE\Talon\LicenseKey\Client' 'expiry'

$mjVer = Read-RegistryEntry 'HKLM:\SOFTWARE\Talon' 'Version_MAJ'
$miVer = Read-RegistryEntry 'HKLM:\SOFTWARE\Talon' 'Version_MIN'
$pchVer= Read-RegistryEntry 'HKLM:\SOFTWARE\Talon' 'Version_PATCH'
$fixVer= Read-RegistryEntry 'HKLM:\SOFTWARE\Talon' 'Version_FIX'
$buildVer= Read-RegistryEntry 'HKLM:\SOFTWARE\Talon' 'Version_BUILD'

$cachePath = Read-RegistryEntry 'HKLM:\Talon\Tafs' 'LocalFSRootPath'
$result = $cachePath -match "[a-zA-z]{1}:"
$cacheDiskCapacity = 0
if($result)
{
$cacheDrive = $matches[0]
try
{
$disk = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='$cacheDrive'" | Select-Object Size,FreeSpace
$cacheDiskCapacity = "{0:N2}" -f ($disk.Size / 1GB)
}
catch
{
$cacheDiskCapacity = -1
}
}
else
{
$cacheDiskCapacity = -1
}

$subKeys = Get-ChildItem 'HKLM:\Talon\tum\Client\ServerDb'
$serverDBList = ""
foreach ($key in $subKeys)
{
$serverDBList = $serverDBList + $key.PSChildName + " | ";
}

$instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computerName)
$instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $computerName)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.Servers']/Major_Version$", $mjVer)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.Servers']/Minor_Version$", $miVer)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.Servers']/Patch_Version$", $pchVer)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.Servers']/Fix_Version$", $fixVer)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.Servers']/Build_Version$", $buildVer)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.Servers']/SysId$", $sysId)

$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.EdgeServer']/expiry$", $expiry)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.EdgeServer']/ServerDb$", $serverDBList)
$instance.AddProperty("$MPElement[Name='Talon.FAST.ComputerRole.EdgeServer']/CacheDiskCapacity$", $cacheDiskCapacity)

$discoveryData.AddInstance($instance)
}

#$api.Return($discoveryData)
$discoveryData</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>computerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>