Udostępnij za pośrednictwem


Getting Started Developing Runtime Scripts

Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007

To develop a runtime script, your development computer must contain a registered copy of the Operations Manager Script library. For more information, see About the Operations Manager Script Library.

Developing a runtime script involves the following tasks:

  • Creating a runtime script.

  • Testing and debugging the script.

  • Adding the script to a Management Pack.

These tasks are outlined in the following sections.

Creating a Runtime Script

You can develop a runtime script in any authoring environment and in either of the following supported scripting languages:

  • JScript

  • VBScript

When you are authoring a runtime script, first create an instance of the MOMScriptAPI object. This is the top-level object in the scripting library, which allows you to create either discovery data or monitoring data. A runtime script can return only one type of data—either discovery data or monitoring data, but not both. For more information about the objects included in the Operations Manager Script library, see Operations Manager 2007 R2 Scripting Objects.

For more information and script examples, see the following:

How to Use Runtime Scripts for Discovery

How to Use Runtime Scripts for Monitoring

Testing and Debugging the Script

You can test an Operations Manager runtime script from a command line, outside of the Operations Manager runtime environment. When the script runs, any output data that is generated by the script can be displayed in a console window as an XML string. This allows you to verify that the script is collecting the appropriate data, before you incorporate the script into a Management Pack.

Runtime scripts can also write events to the Operations Manager event log, which can provide information about anticipated errors that occur while the script is running. For more information, see How to Create Operations Manager Events by Using a Script.

If you encounter any problems with a script, you can debug it using any script debugger. For more information, see Debugging Runtime Scripts.

Adding the Script to a Management Pack

To use a runtime script in Operations Manager, you must add the script to a Management Pack. The script then runs automatically during regular discovery or monitoring operations. Possible methods of incorporating a script into a Management Pack include the following:

  • Creating a new data source module type that allows you to use the script to collect data for a discovery, monitor, rule, or task.

  • Adding the script to a specific discovery, monitor, rule, or task.

For more information, see How to Use Discovery Data in a Management Pack and How to Use Monitoring Data in a Management Pack.

See Also

Concepts

Debugging Runtime Scripts
Runtime Scripts Overview