Making Management Packs Agentless-Aware

Management Packs work in agentless environments without any modifications. Depending on the implementation of the Management Pack, the following areas should be taken into account when you write new scripts or modify existing scripts while upgrading a Management Pack from a previous version of MOM. These changes include:

  • Obtaining the computer name that a script is executing under ScriptContext.TargetComputer (or other methods).

  • Instantiating objects (ensure that objects are created for the target computer).

  • Opening registry connections (ensure that your connections are created for the target computer).

Script Awareness

To ensure your Management Pack scripts work agentlessly, the following script context methods can be used to obtain the target computer name that the script is running against.

  • TargetComputer

  • TargetNetBiosComputer

  • TargetFQDNComputer

  • TargetNetBiosDomain

  • IsTargetAgentless (Boolean)

  • TargetComputerIdentity - (Domain\NetbiosComputer)

All of these methods are agentless management-aware. With MOM 2000 SP1, methods for obtaining the computer name return the name of the server, running MOM, that provides the agentless management. Scripts will use the name of the Management Server, not the managed computer, which results in incorrect monitoring results.

Instantiating script objects, primarily for registry connections or other monitoring purposes, should be written to take into account agentless management. When creating objects or registry connections, you should first determine whether you are creating the object for the local computer or creating the object or connection for a remote computer (as is the case with agent monitoring). The following code sample shows how this condition might be handled.

If Not(isTargetAgentless) Then
      'get the registry object for local machine
      Set oReg =GetObject("winmgmts:root\default:StdRegProv")
Else
      Set oReg =GetObject("winmgmts:\\"+ sHostName + "\root\default:StdRegProv")
End If

If you are instantiating objects that require the application object model to be available (it might not be present on servers running MOM) you should ensure that you have appropriate error handling to prevent these rules from being applied, More information about error handling with agentless management is covered later in this guide.

Backward Compatibility and Limitations

The script context methods outlined in this guide apply only to MOM 2005. Consequently, it is important to consider backwards compatibility with script changes if you want to back-port scripts to earlier versions of MOM. Script methods that support agentless monitoring do not work in previous versions of MOM, and will cause script errors.

Preventing Agentless Management

Computer group formulas can be targeted based on agent type. These can be used to exclude particular rule groups, or entire Management Packs, from agentless management. Agentless targeting uses the new ManagementMode attribute in formulas. The following types of management modes can be used in computer group formulas:

  • Agentless

  • Agent

  • Unmanaged

For example, the following formula targets only agentless computers:

AttributeValue(Management Mode)= "Agentless"

Acknowledgments

Author: Tom Keane

Co-Authors: Chris Hallum, Dale Koetke, Thomas Theiner

Applies To:   Microsoft Operations Manager 2005

Primary Reviewers: Steve Wilson, Matthew Brown, James Hedrick, James R. Morey

Managing Editor: Sandra Faucett