Develop > Groovy scripts

Groovy scripts

OMi supports script-based customization. Using scripts enables adding functionality to the OMi process flow in situations where the required functionality is not provided in OMi or cannot be added using the standard OMi tools and configuration options.

How this section is organized

This section documents where and how Groovy scripts can be added. It includes the following parts:

  • There are several different areas where customization is possible. How to develop and deploy scripts for each area is discussed in detail in section Development and deployment of scripts.
  • Reference information applicable to any script is provided in section Reference information.
  • Guidance on best practices when developing scripts is provided in section Best practices.

Introduction to customization scripts

The following aspects are critical to developing successful customization scripts:

  • Script Execution Trigger

    The trigger causing the script to be executed. For example, scripts can be configured to run in conjunction with the occurrence of an event. Triggers are detailed in Development and deployment of scripts, in the sections relevant to the various types of customization under the Process Flow heading.

  • Script Execution Process Location

    The place in the process flow when the script is executed. For example, event-based scripts can be configured to be executed before the event is processed, or after. Available locations are detailed in Development and deployment of scripts, in the sections relevant to the various types of customization under the Process Flow heading.

  • Programming Language

    OMi supports Groovy scripts. Groovy is a dynamic object-oriented programming language for the Java platform. When used as a scripting language for the Java Platform, Groovy is dynamically compiled to Java Virtual Machine (JVM) bytecode making it compatible with external Java code and libraries. Groovy is similar to Java, and most Java code is syntactically valid in Groovy. Details about the Groovy syntax are outside the scope, but there are numerous sources on the Internet you can refer to. A good start is to search for Groovy (programming language) on Wikipedia, and use the list of references mentioned in the article. The official website is at the following URL:

    http://groovy.codehaus.org/

    For more information about obtaining the Groovy console, as well as OMi-specific information on installation, deployment and debugging using the console, see Groovy console.

  • Script Format

    Scripts need to follow a specific format so that the OMi procedure calling the script is able to execute it correctly in the various process locations where scripts can be added. Template scripts and examples are provided with the installation. Details about the format to be used for the various types of customization are detailed in Development and deployment of scripts, in the sections relevant to the various types of customization under the Format heading.

  • Information Functions

    Scripts are often used to add information about the managed configuration items (CIs) to the standard information set. The information to be added must be obtained from various services and processes. Use the functions from the appropriate Application Programming Interface (API). For example, when enriching event information you can use the functions from the RTSM Java API to retrieve information from a CI. The available OMi and external APIs are listed in Available APIs. Examples of functions are detailed in Development and deployment of scripts, in the sections relevant to the various types of customization under the Example heading.

  • Best Programming Practices

    Best practices and things you should avoid are detailed in Best practices. Any specific best practices that should be followed are detailed in Development and deployment of scripts, in the sections relevant to the various types of customization under the Best Practices Specific to ... heading.

  • Script Management

    Scripts are placed on the server running the OMi instance and configured for the appropriate process using the OMi console. How to configure a script depends on where it is used. The steps you need to take to include and activate your scripts are detailed in Development and deployment of scripts, in the sections relevant to the various types of customization under the Script Management heading.