Manually Trigger Object Discoveries in SCOM

Chiyo OdikaOpsMgr, PowerShell, SCOMLeave a Comment

System Center Operations Manager (SCOM), a component of Microsoft System Center 2016 is a software that helps you monitor services, devices, and operations for computers within your infrastructure. This article provides an overview of object discoveries in SCOM and how to manually trigger them. Note that System Center Operations Manager (SCOM 2016) is still in its technical preview (TP5) at the time of this posting but will be launched in a few weeks during Microsoft Ignite 2016.

SCOM uses a agent installed on a computer to collect data, compare sampled data to predefined values, create alerts, and run responses. The agent then sends monitoring data to the management server in the SCOM management group. Management servers run various services, including the System Center Management configuration service which among other roles, distributes management packs to monitored objects. Management packs define the information that agents collect and return to the management server(s) for a specific technology or application. Management packs are comprised of various configurations for discovering, and monitoring various technologies. The configurations include object discoveries, rules, monitors. etc. Object discoveries are a crucial part of the initial configuration that SCOM sends to agents. Object discoveries define the types of objects such as applications and features that SCOM will monitor on agent-managed computers, and once a given technology or application type is discovered on a computer, the relevant monitoring rules and monitors for that technology or workload then execute on the computer on a pre-defined interval. Learn more about Key SCOM concepts here.

Object Discovery Configuration

When working with object discoveries, it’s important to take note of a couple of configurations, including the object discovery target, and discovered classes, and such discovery configuration properties as the interval of execution, discovery timeout and so on. In this post, we will make use of a discovery for SQL Instances. The discovery name in question is Discover Databases for a Database Engine. To review the properties for this object discovery you can make use of the Get-SCOMDiscovery cmdlet, or review the some limited configuration information for the discovery in the SCOM console. To view the discovery properties in the SCOM console:

  1. Navigate to the Authoring workspace in the SCOM Console
  2. Expand Management Pack Objects and select Object Discoveries
  3. Search for Discover Databases for a database engine.
  4. Select the object discovery for SQL Server 2012 DB Engine and open the properties.

In the general tab of the properties for the object discovery, you can review the object discovery target.

image

And in the configuration tab, you can review configuration information for the object discovery.

image

 

To manually trigger object discoveries in SCOM, you will need distinct IDs for the Target Instance (object instance that you’d like to make subject to the discovery), and Discovery (the discovery that you’d like to run manually). You can get both of these IDs using the relevant PowerShell cmdlets. So we’ve determined from the properties of our discovery above that the discovery in question targets objects of class SQL Server 2012 DB Engine, so the target instance will need to be an instance of this class. To enumerate all target instances of the class SQL Server 2012 DB Engine, use the following one-liner.

Get-SCOMClass | Where{$_.DisplayName -like "SQL Server 2012 DB Engine"} | Get-SCOMClassInstance

image

This returns all of the potential target instances for the class. You can then get Id information for the target instance of interest using the following:

Get-SCOMClass | Where{$_.DisplayName -like "SQL Server 2012 DB Engine"} | Get-SCOMClassInstance | Where{$_.DisplayName -like "CHIYOLB2"} ft DisplayName, Id

Now that we have the ID information for the target instance, let’s get the ID information for the discovery.

Get-SCOMDiscovery | Where{$_.DisplayName -like "Discover Databases for a Database Engine" -and $_.Name -like "*2012*"} | ft DisplayName, Id

Notice that in addition to the display name for the discovery, I further queried by name because certain discoveries will exist with identical displaynames for various iterations of a given application/ technology, such as SQL 2005/ 2008/ 2012/ 2014 etc.

Now that we have the TargetInstance and Discovery IDs, we are ready to manually run the discovery. To do so:

  1. Navigate to the Monitoring workspace in your SCOM console.
  2. Navigate to an expand the Operations Manager folder, and the Agent Details folders.
  3. In the Agent State view, select the agent computer/ node that holds the SQL instance referenced for the Target Instance.
  4. Click the Trigger On Demand Discovery task in the Tasks pane.
  5. In the resulting window, click the Override button to open the Override Task Parameters window
  6. In the Override Task Parameters window, enter your TargetInstanceId, and DiscoveryId in the New Value fields for the respective entries, and click Override, and Run to run the task.

image

 

image

 

image

And all things being equal, you should see the desired output indicating that the task completed successfully. I hope you find this instructive. Cheers!

The following two tabs change content below.
Strategist. Technologist. Skeptic. Friend.
Chiyo OdikaManually Trigger Object Discoveries in SCOM