Operations Center – Custom Right Clicks – Continued

Tobin Isenberg

By: Tobin Isenberg

November 13, 2013 11:56 am

Reads: 333

Comments:0

Rating:5.0

In my previous blog Operations Center – Custom Right-Clicks – Menu Options, I discussed the basics of setting up custom right clicks in the Operations Center console. I will finish the topic in this blog by cover the other Operation Definitions settings.

For review:

  • Operations are managed under Administration\Server\Operation Definitions
  • The “Name” of the definition ends up as the name of the element that stores the definition, this is not shown to the end user
  • The “Menu text” is what is displayed in the right-click menu. Menu text supports HTML formatting.

Context: This setting is to determine where the operation should show up. Options are for element, alarms or both. Really depends on what you need to do. The both option is nice, but you need to keep “both’ in mind when you do the other settings, specifically, the scripting part. More on this further down.

Match by: This is a way for you to control the type of elements and/or alarms to make this custom right click available. For instance, you might only want to make a SSH operation available for elements that are of class “Unix”. Or you may only want a custom “ACK” operation available if the alarm status is currently set to “Open”.

The basics are hard coded values such as Distinguished Name, Name and Class. For those types, you need to type in the full case sensitive value.

The more advanced ones are names the same as above, but have “Expression” on the end. So Distinguished Name Expression would be something like .*unix.*=.* Maybe not the best way, but it is an example, basically any class that has “unix” in it. Probably should do case insensitive in the expression. Expressions are based on perl regular expression which is highly documented on the web.

The other options is script. For this option you can do just about anything, but remember, any time someone right-clicks, the script is fired, so be careful what you do, it will cause the menu to hesitate from coming up. An example (not the best, but it is an example), would be something like….

var result = false;

if( element.ip.indexOf( "192.*") >= 0)

{

result = true;

}

(result)

The script above is checking a property on the element called “ip”, then doing a check to see if it starts with 192, if so it sets a value. The thing to remember is, the last line of the script must return some type of boolean results. There are a number of ways to do the script above, in fact, this example could be probably be a one liner…

( element.ip.indexOf("192") )

I *think* it would work, but regardless, just giving you an idea of what you can do in the scripts.

Permission: After your match qualifies, the next thing evaluated is permissions. You have the choice of View through Define. So if the end user has a minimum of the option you select, then they can see the operation. View is the most basic, Define is the highest, meaning, if the user is able to add elements (i.e: an admin), then the right-click will show up.

Type: Several options available, really depends on what you are trying to do. Here are the basics

Serverscript. If the operation is executed, the script runs in context to the server. So if you script brings up a dialog, an ok/info box, etc, it will come up on the server. (Unless you do some more work in the script to send it back to the client).

Clientscript. When the operation is performed, the script will run on the end users system. If your script accesses a jar file, it needs to be local, if you access email or a database, it is from the workstation.

Process. This executes a process like dir, ls, etc. I have not really used it because typically I need to do more than just run a process. I recommend using server script or client script. To run a process, use the standard java method of getRuntime.exec().

Prompt. This is a way to have the system automatically prompt the user for items to fill out. It returns the values via an args array. Same point as “Process”. I think doing a client script makes more sense, you probably would like to put up a nicer dialog and then do things afterwards. Both options (client script and prompt) will work, but I typically use client script for this.

URL Frame, popup, Web script and HTML result: This operations are specific to the CMS interface (AKA: myCMDB). There are plans to add these options for the Dashboard, but at this time they are not available. The idea here is that you are not doing java script, you are doing dashboard related actions/script. I thought I had a blog on this but I can’t find it. Since this is a bigger topic, I’ll defer examples for now.

Operation: This is where the bulk of the settings is done. More specifically, this is where you do the scripting. Keep in mind that script in Operations Center is based on java script. While java script classes/courses are focused on doing java script within a webpage, this is more like doing java (IE: not embedding java script in a HTML or JSP page). In fact, I typically use the standard java docs as an API reference. I’d say around 90% of java scripting is based on java programming and nothing specific with Operations Center.

Tips.

  • Depending on the Operation type (server, client), some Operations Center methods may or may not be available.
  • Based on the context, some variables are made available to you, i.e.: elements or alarms.
  • When do an alarm operation definition, the pre-defined “alarms” variable is an array. The user may have selected one alarm, they may have selected 100 alarms.
  • You can email, talk to databases, SNMP, file I/O, etc, etc, etc… that is all “java” stuff, not NOC.

example sever script, element context

formula.log.info( "User selected element: " + element.name + " within NOC" );

example client script, alarms context

info( "User highlighted " + alarms.length + " alarms in NOC" );

While these are one liners, you can write a whole interface with drop downs, radio buttons, etc, etc. Issue inserts and updates against a database, etc. It is nearly endless. You can write a java application, compile it and then have a one liner java script that executes it.

That about covers that basics of operations. I have other blogs on specific operation examples. Read through them. If you have any specific use cases you would like me to blog on, please comment on this post with a request.

 

- Tobin

 

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
Operations Center - Custom Right Clicks - Continued, 5.0 out of 5 based on 1 rating

Tags: ,
Categories: Operations Center, Technical Solutions

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Comment