A few opsmgr questions of interest - Question 4

1. Is it possible to write a rule/monitor that targets all objects, a single object and all objects except one? If so, how would it be done? Include examples of how to target a rule to all SQL instances. Then how to target a single SQL instance. Then how to target all instances except a single instance, or a group of instances.

Targeting in this manner is definitely possible in opsmgr. In some cases, the way we target these scenarios may be a bit different than would be anticipated. The examples below walk through each configuration starting with a basic monitor and then expanding to a more complex configuration with a SQL performance monitor.

Basic monitor
This example will build a unit monitor for acting on a particular event in the event log of our agents.

All Objects
1. Select to create a new unit monitor.

2. Choose a timer reset based event detection monitor. Note here that the monitor will be created in the default management pack. Using the default management pack is not a best practice in production.

3. Target the monitor to the Windows Computer object. This will ensure that every system running a Windows operating system will receive this rule.

The monitor is now configured and will be downloaded and applied by all managed agents.

Target a single object

Targeting a monitor to a single instance of an object is also easy – but it requires the use of overrides. Basically, a monitor is created that targets an object as a whole – which will likely mean targeting multiple machines. Since we don’t want the monitor to be applied to every machine with the targeted object we should immediately disable it. So, the monitor will be properly configured and ready to use but won’t be deployed because it is disabled. To deploy the monitor to the machine you want, simply create an override for the specific machine. Here are the steps.

1.  Create a monitor and disable it. Notice that this monitor is identical to the first example except that it is disabled.

2. Create a monitor override to ENABLE the monitor for a single system.

 

 

3. The monitor is now configured to be deployed to only a single system.

Target all objects EXCEPT a single object

Configuring a monitor/rule to target all objects of a particular type except one is very similar to what we just did. We will build the monitor, ensure it is targeted appropriately AND enabled. We will then create a DISABLE override to exclude one or more targeted systems from receiving the monitor. Here are the steps.

1. Create and target the monitor. Note that the monitor is enabled.

2. Create an override to DISABLE the monitor on one or more computers.


 

3.  The monitor is now configured to apply to all objects of the defined time except the one system.

Complex SQL performance monitor
Now that we have a good idea about how to create and target monitors let’s look at a more complex example. Here we will configure a performance monitor to capture performance data from the default instance of all SQL servers. We will modify the monitor to target all instances of SQL (default and named) to collect the data. We will then modify the monitor to target all instances (default and named) of SQL in the environment except one.

Default SQL instance

1. Create a monitor to capture performance data. Notice that the target is to all SQL server DB engines. This means that all SQL servers will get the monitor but we still need to tell the monitor what performance data to collect.

2. Define the performance data we should collect and from what SQL instance.

Select the performance counters of interest by browsing to a SQL server that contains the counter. In our example, we are using a default instance but could just as well use a named instance. If we use a named instance the format of the ‘object’ entry in the next screen would be different. One point of confusion may be that only a single instance of a SQL server is being designated to locate the counters. Our example stated we are building a monitor to capture performance data on all default instances of SQL Don’t confuse the computer entry that is used for browsing performance counters for the actual systems we are monitoring. The object entry in the next screenshot will help clear this up.

The monitor is now configured and will monitor the configured performance counter on ever y SQL server in the environment containing a default SQL instance and with the requested performance counters. How do we know we are monitoring the default instance? Look at the format of the object name. In SQL terms, the default instance is referenced generically as SQLServer. If we would have chosen a named instance when selecting the performance counter we would see a different reference here

Monitoring all default AND named SQL instances

If we would prefer to monitor the performance counter for all default and named instances of SQL server in the environment we need to adjust the object to use a variable to identify the type of SQL server to monitor instead of specifying it. In SP1, we have made this easier by adding a ‘flyout’ option list where we can choose this variable

This will result in a very long variable string being placed in the Object dialogue. The full variable entered is: SQLServer:Databases$Target/Property[Type="MicrosoftSQLServerLibrary6050000!Microsoft.SQLServer.DBEngine"]/PerformanceCounterObject$

We will need to append :Databases to the end of this variable as that entry is only added when we browse for our SQL server instance type. In this example we only apply this variable to the Object selection. If we have performance counter instances that are tied to individual SQL server instances we could also use the variable there to ensure we collect all instances of the perf counter that we need.

Excluding specific SQL instances from monitoring while including all default and named SQL instances

Now that we have the performance rule configured to pick up the counter data from all installed instances, both default and named, we can further customize the rule with overrides to exclude a specific or several specific instances (either default or named) by using groups.

1. Create a group and specify the target as SQL 2005 DB Engine. Use the search filter to select the default or names instances we want to exclude. Save the group after we have finished populating the membership.

2. Create a monitor override to disable the monitor for the computer group just created.