Operations Discovery

com.apcc.ISXO.PRO.Operations.Discovery (Discovery)

Workflow for discovering StruxureWare Operations endpoints for use in Virtual Machine Manager

Knowledge Base article:

Summary

This discovery looks for settings in the registry specifying the location of the StruxureWare Operations service and the Virtual Machine Manager service.

Element properties:

TargetMicrosoft.Windows.Server.Computer
EnabledTrue
Frequency14400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

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

Source Code:

<Discovery ID="com.apcc.ISXO.PRO.Operations.Discovery" Enabled="true" Target="Windows!Microsoft.Windows.Server.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="com.apcc.ISXO.PRO.Operations"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>14400</IntervalSeconds>
<SyncTime/>
<ScriptName>com.apcc.ISXO.PRO.Operations.Discovery.js</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>/*****************************************************
Script: ISX Operations Registration Discovery
*****************************************************/
var m_strScriptName = "com.apcc.ISXO.PRO.Operations.Discovery.js";
var debug = true;

//
// Unpack the arguments into module-level vars.
//
var m_strRuleID = WScript.Arguments(0);
var m_strTargetID = WScript.Arguments(1);
var m_strPrincipalName = WScript.Arguments(2);

//
// The main point: using the API, create a Discovery DataItem
//
var m_oAPI = new ActiveXObject("MOM.ScriptAPI");
if (debug)
m_oAPI.LogScriptEvent(m_strScriptName, 2720, 0, "Script started.");

var m_oDiscoveryData = m_oAPI.CreateDiscoveryData(0, m_strRuleID, m_strTargetID);

//
// This is the top of the discovery logic tree...
//
discoverOperations();

//
// Return the Discovery DataItem, as populated.
//
m_oAPI.Return(m_oDiscoveryData);

if (debug)
m_oAPI.LogScriptEvent(m_strScriptName, 2721, 0, "Script completed.");

function discoverOperations() {
var oShell = new ActiveXObject("Wscript.Shell");

var strOperationsName = "";
var strVMMServer = "";
var strVMMServerPort = "";
var strISXOEndpoint = "";

var iCount = 0;

do {
strOperationsName = "";
strISXOEndpoint = "";
strVMMServer = "";
strVMMServerPort = "";

try {
strOperationsName = oShell.RegRead("HKLM\\Software\\APC\\MsScOpsMgrMpForIsxo\\Name" + iCount);
var strVMMServerAndPort = oShell.RegRead("HKLM\\Software\\APC\\MsScOpsMgrMpForIsxo\\VMM" + iCount);
strISXOEndpoint = oShell.RegRead("HKLM\\Software\\APC\\MsScOpsMgrMpForIsxo\\FQDN" + iCount);

var strTempVMMServerAndPort = strVMMServerAndPort.split(":");
strVMMServer = strTempVMMServerAndPort[0];
strVMMServerPort = strTempVMMServerAndPort[1];
}
catch (oEx_dc1) {
}

// Only discover valid registry entries.
if (strOperationsName.length &gt; 0 &amp;&amp; strISXOEndpoint.length &gt; 0 &amp;&amp; strVMMServer.length &gt; 0) {
if (debug)
m_oAPI.LogScriptEvent(m_strScriptName, 2720, 0, "Discovered operations.");

// Create an instance of an Operations.
var oOperationsInstance = m_oDiscoveryData.CreateClassInstance("$MPElement[Name='com.apcc.ISXO.PRO.Operations']$");

// Set the properties, as required.
oOperationsInstance.AddProperty("$MPElement[Name='com.apcc.ISXO.PRO.Operations']/HealthServicePrincipalName$", m_strPrincipalName);
oOperationsInstance.AddProperty("$MPElement[Name='com.apcc.ISXO.PRO.Operations']/ISXOEndpoint$", strISXOEndpoint);
oOperationsInstance.AddProperty("$MPElement[Name='com.apcc.ISXO.PRO.Operations']/VMMServer$", strVMMServer);
oOperationsInstance.AddProperty("$MPElement[Name='com.apcc.ISXO.PRO.Operations']/Port$", strVMMServerPort);
oOperationsInstance.AddProperty("$MPElement[Name='com.apcc.ISXO.PRO.Operations']/Name$", strOperationsName);
oOperationsInstance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", strOperationsName);

// Now add the central the Discovery DataItem returning to OpsMgr.
m_oDiscoveryData.AddInstance(oOperationsInstance);

// Create a ShouldManage relationship between the Health Service and this Central instance
var oHealthServiceToCentralRelationshipInstance = m_oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthServiceShouldManageEntity']$");
var oHealthServiceInstance = m_oDiscoveryData.CreateClassInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthService']$");
oHealthServiceInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", m_strPrincipalName);
oHealthServiceToCentralRelationshipInstance.Source = oHealthServiceInstance;
oHealthServiceToCentralRelationshipInstance.Target = oOperationsInstance;
m_oDiscoveryData.AddInstance(oHealthServiceToCentralRelationshipInstance);
}

iCount++;

WScript.Sleep(0); // Yield control on loops to keep the overall system responsive.
}
while (strISXOEndpoint.length &gt; 0);
}</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>