Discovery der Beziehung von Servern in Citrix Zonen

Citrix.PresentationServer.ZoneServerRelationshipDiscovery (Discovery)

Ermittelt die Beziehungen zwischen mit Citrix verwalteten Servern und den Citrix Zonen, in denen sie enthalten sind.

Element properties:

TargetCitrix.PresentationServer.ManagedServer
EnabledTrue
Frequency4500
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.CommandExecuterDiscoveryDataSource Citrix.PresentationServer.CitrixAdministratorAccount

Source Code:

<Discovery ID="Citrix.PresentationServer.ZoneServerRelationshipDiscovery" Enabled="true" Target="Citrix.PresentationServer.ManagedServer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Citrix.PresentationServer.ManagedServer">
<Property PropertyID="ProductDescription"/>
<Property PropertyID="HotfixInfo"/>
<Property PropertyID="LicenseServer"/>
<Property PropertyID="LogonsEnabled"/>
<Property PropertyID="IsFMS"/>
<Property PropertyID="IsZDC"/>
</DiscoveryClass>
<DiscoveryClass TypeID="Citrix.PresentationServer.Zone">
<Property PropertyID="Name"/>
<Property PropertyID="NumberOfServers"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="CtxLibrary!Citrix.PresentationServer.CitrixAdministratorAccount" TypeID="System!System.CommandExecuterDiscoveryDataSource">
<IntervalSeconds>4500</IntervalSeconds>
<ApplicationName>%windir%\System32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>//nologo $file/DiscoverZoneServerRelationship.js$ 0 $MPElement$ $Target/Host/Id$ "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$" "$Target/Property[Type="CtxLibrary!Citrix.Library.ServerApplication"]/Name$" "$Target/Property[Type="CtxLibrary!Citrix.Library.ServerApplication"]/Farm$" "$Target/Property[Type="CtxLibrary!Citrix.Library.ServerApplication"]/Zone$"</CommandLine>
<TimeoutSeconds>300</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>DiscoverZoneServerRelationship.js</Name>
<Contents><Script>
/*************************************************************************
*
*
*
*
* Copyright 2006 Citrix Systems, Inc. All Rights Reserved.
*
*************************************************************************/

var SCRIPT_NAME = "Citrix Zone Server Relationship Discovery";

// event constants
var EVENT_TYPE_SUCCESS = 0;
var EVENT_TYPE_ERROR = 1;
var EVENT_TYPE_WARNING = 2;
var EVENT_TYPE_INFORMATION = 4;


var SourceType, SourceID, ManagedEntityId, TargetComputer, ServerName, FarmName, ZoneName;

if ( WScript.Arguments.Unnamed.Count == 7 )
{
SourceType = WScript.Arguments(0);
SourceID = WScript.Arguments(1) ;
ManagedEntityId = WScript.Arguments(2);
TargetComputer = WScript.Arguments(3);
ServerName = WScript.Arguments(4);
FarmName = WScript.Arguments(5);
ZoneName = FarmName + ":" + WScript.Arguments(6);
}
else
{
WScript.quit()
}

//Logs an error event to the MOM event log
function logError(message, error)
{
var str = SCRIPT_NAME + ":\n" + message;

if (error)
{
var num = (error.number &lt; 0) ? (error.number + 0x100000000) : error.number;
var estr = error.description;

if (num == 0x80010105)
estr += " [RPC_E_SERVERFAULT: The server threw an exception.]";
else if (num == 0x80041001)
estr += " [WBEM_E_FAILED]";
else if (num == 0x80010108)
estr += " [RPC_E_DISCONNECTED]";
else if (num == 0x8007007e)
estr += " [ERROR_MOD_NOT_FOUND: The specified module could not be found.]";
else if (num == 0x80041010)
estr += " [WBEM_E_INVALID_CLASS]";
else if (num == 0x8004100e)
estr += " [WBEM_E_INVALID_NAMESPACE]";

if (estr == "")
estr = "&lt;error description not given&gt;";

str += ":\n\tReceived error: 0x" + num.toString(16) + ": " + estr;
}

var WshShell = new ActiveXObject("WScript.Shell");
WshShell.LogEvent(EVENT_TYPE_ERROR, str);
}

function Main()
{
try
{
var oAPI = new ActiveXObject("MOM.ScriptAPI");
var oDiscoveryData = oAPI.CreateDiscoveryData(SourceType, SourceID, ManagedEntityId);
}
catch(ex)
{
logError("Error creating discovery data", ex);
return;
}

// Create zone contains managed server
try
{
var oServerInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Citrix.PresentationServer.ManagedServer']$");
oServerInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer);
oServerInst.AddProperty("$MPElement[Name='CtxLibrary!Citrix.Library.ServerApplication']/Name$", ServerName);

var oZoneInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Citrix.PresentationServer.Zone']$");
oZoneInst.AddProperty("$MPElement[Name='Citrix.PresentationServer.Zone']/Name$", ZoneName);

var oZoneContainsManagedServer = oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='Citrix.PresentationServer.ZoneContainsManagedServer']$");
oZoneContainsManagedServer.Source = oZoneInst;
oZoneContainsManagedServer.Target = oServerInst;
oDiscoveryData.AddInstance(oZoneContainsManagedServer);
}
catch (ex)
{
logError("Failed to create an instance of Citrix.PresentationServer.ZoneContainsManagedServer relationship class", ex);
}

// Submit discovery data
oAPI.Return(oDiscoveryData);
}

Main();
</Script></Contents>
</File>
</Files>
</DataSource>
</Discovery>