HP Operations Manager i (OMi) serves both as best-in-class solution for System Management and as a consolidated Operations Bridge incorporating events from many IT sources—into a single pane of glass view. OMi customers say they love its out-of box functionality and its high customization capabilities—especially when it comes to scripting. If you have already used it, then you are familiar with the scripting technology. If you are new , then this might help you: It is "Groovy".
So what is Groovy?
Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk.... Most Java code is also syntactically valid Groovy, although semantics may be different. Reference Wikipedia: Groovy (programming language)
Both - Java and Groovy - languages are highly used in the Enterprise IT. Therefore there are lots of communities and forums to learn the language and share experiences with others. If you want to learn Groovy, I am positive you will find lots of great resources and your learning curve will be quick – especially when you have already a Java background.
Therefore I want to focus on where Operations Manager i is using Groovy today and share some of the best practices with you.
Where is Groovy used in OMi?
OMi offers various places, where you can plug-in scripting. This is called scripting types in OMi: Event Processing Customization, Custom Actions, Connected Servers, Certificate handling, Event Forwarding and many more.
Let’s say you want to customize an event? No Problem, use the Event Processing Customization script.
You want to forward an event? No problem, use Event Forwarding script.
And remember, for all of these different scripting types Groovy is used. There is no need to learn different scripting languages. Just talk Groovy!
In OMi, you will find online documentation for each scripting type and in addition you will also find an API documentation with sample code.
Here is some additional information that is good to know: For the Event Processing Customization there is also a scripting development kit available. The Script Dev Kit is included in the Operations Manager i 10 installation media. Once OMi10 is installed, the Script Dev Kit can be found at: <InstallDir>/opr/support/script-devkit
All of the scripts in OMi have a template or they have some kind of structure/skeleton—which is more or less generic for all OMi scripts.
This means that these scripts have a init(), process() and destroy() method. With these you are able to interact with the OMi scripting system in various phases.
init() can be used to do some work before your script starts. For example, think of initial cache loading or any other mechanism which needs to be done upfront.
The process() is the central function of your script and where the main work is done.
destroy() can be used to do some cleaning work (e.g. erase some temporary files) before exiting the script
Where is the script stored?
Storage of scripts
Whenever you create or update a script, all of the content is stored centrally in the OMi Database. This is advantageous because the script:
Can be edited from the web browser
Cannot be deleted from the filesystem
Is available to all connected OMi servers in case of a shared deployment
Now before you start your career as OMi script developer, let me share some best practices.
In order to make the best out of OMi Groovy scripts, I recommend using an external editor or even better a development kit. There are already lots of editors or development kits in the wild, so just select whatever editor you prefer.
An editor gives you the benefit of having line numbers and possibly existing code formatting
In case you use a development kit, you can also benefit from syntax highlighting and code completion
With the OMi script devkit you can also test your scripts by connecting to a running OMi and read events from your system.
Performance: Another best practice I want to highlight is to take an eye of the overall performance. In most places where you can add your OMiGroovy script it is also possible to use event filters. This ensures the script is executed in the right context and does not waste performance. Also I recommend making use of caching techniques whenever possible. (Maybe you remember the init() method I have previously mentioned.)
HP Operations Manager i IT Event Correlation software has lots of places where you can interact with Groovy. I hope this blog has shown you the most important places to utilize Groovy and how you can make the best out of it.