Origen de datos de alertas de comunidad

Citrix.PresentationServer.FarmWideAlerts.DataSource (DataSourceModuleType)

Se ocupa de recopilar mediciones de la comunidad en una comunidad de Citrix

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.CommandExecuterPropertyBagSource Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalInSecondsint$Config/IntervalInSeconds$

Source Code:

<DataSourceModuleType ID="Citrix.PresentationServer.FarmWideAlerts.DataSource" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalInSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalInSeconds" Selector="$Config/IntervalInSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/IntervalInSeconds$</IntervalSeconds>
<ApplicationName>%windir%\system32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>//d $file/DetectFarmWideAlerts.js$</CommandLine>
<TimeoutSeconds>60</TimeoutSeconds>
<RequireOutput>false</RequireOutput>
<Files>
<File>
<Name>DetectFarmWideAlerts.js</Name>
<Contents><Script>
/*************************************************************************
*
*
*
*
* Copyright 2006 Citrix Systems, Inc. All Rights Reserved.
*
*************************************************************************/

var SCRIPT_NAME = "Citrix Detect Farm-Wide Alerts";
CITRIX_WMI_MGMT_CONNECT = "WINMGMTS:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}\\\\.\\root\\Citrix\\Management";

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

//Name strings used to key farm status information cached using the ScriptState object
MAPI_CONFIGURATION = "MapiConfig";
SDB_IMPORT= "SdbImport";
PRIMARY_FMS_REQUIRES_UPGRADE= "PrimaryFmsUpgrade";
SECONDARY_FMS_REQUIRES_UPGRADE= "BackupFmsUpgrade";
DCS_CONNECTION_ERROR = "DCSConnError";
DCS_UNREACHABLE = "DcsUnrechable";
DCS_REQUIRES_UPGRADE = "DcsUpgrade";
DCS_UNCONFIGURED = "DcsConfig";
SMS_ISDN_CONFIG = "SmsISDNConfig";
SMS_ANALOG_CONFIG = "SmsAnalogConfig";

//Logs an error event to the 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 oWMIService = GetObject(CITRIX_WMI_MGMT_CONNECT);
}
catch(ex)
{
logError("Error connecting to Citrix WMI management service", ex);
return;
}

try
{
var oFWSOutParams = oWMIService.ExecMethod("FarmMetricsAPI", "QueryFarmWideStatus");
if(oFWSOutParams.ReturnValue != 0)
{
logError("Error obtaining Farm Wide Status from WMI: QueryFarmWideStatus returned value: " + oFWSOutParams.ReturnValue, 0);
}

var farmStatusFlags = oFWSOutParams.Status.toArray();

try
{
var oAPI = new ActiveXObject("MOM.ScriptAPI");
oBag = oAPI.CreatePropertyBag();
}
catch(ex)
{
logError("Error creating property bag", ex);
return;
}

// Record each flag's value
oBag.AddValue(MAPI_CONFIGURATION, farmStatusFlags[1]);
oBag.AddValue(SDB_IMPORT, farmStatusFlags[2]);
oBag.AddValue(PRIMARY_FMS_REQUIRES_UPGRADE, farmStatusFlags[3]);
oBag.AddValue(SECONDARY_FMS_REQUIRES_UPGRADE, farmStatusFlags[4]);
oBag.AddValue(DCS_CONNECTION_ERROR, farmStatusFlags[5]);
oBag.AddValue(DCS_UNREACHABLE, farmStatusFlags[6]);
oBag.AddValue(DCS_REQUIRES_UPGRADE, farmStatusFlags[7]);
oBag.AddValue(DCS_UNCONFIGURED, farmStatusFlags[8]);
oBag.AddValue(SMS_ISDN_CONFIG, farmStatusFlags[9]);
oBag.AddValue(SMS_ANALOG_CONFIG, farmStatusFlags[10]);

oAPI.Return(oBag);
}
catch (ex)
{
logError("Error processing farm-wide status", ex);
return;
}
}

Main();
</Script></Contents>
<Unicode>true</Unicode>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>