NetIQ Operations Center: How to Copy Alarm(s) To Clipboard

Tobin Isenberg

By: Tobin Isenberg

May 31, 2012 1:20 pm

Reads: 20441

Comments:0

Rating:0

Have you ever wished you could highlight a few alarms in the NetIQ Operations Center console, copy them to the clipboard and then paste them into an email, or a help desk ticket or somewhere else? Guess what – you can. There is not out of box feature for this, but with a few clicks and the small script below, you’ll be on your way. In order to leverage this, you will need Administrative permission to add an Operation. The Operation should be configured as an Alarm operation and as a client script.

The script (I hope) is pretty straight forward , so hopefully I’m just providing a review.

The script below starts out by declaring a couple variables, the first one (results) is for the variable to hold the contents of the alarms that are highlighted and the second (cr) is just to split up lines to make the pasted output more readable.

The next section contains two for loops. The first for loop is intended to process all the alarms that were highlighted for this right-click. The second for loop walks through the individual alarm to gather the alarm field names and field values.  Once it has done that, the field and value are stored in the “results” variable.

The last four lines are standard java for gaining access to the clipboard and placing the contents of the “results” variable into the clipboard.  That’s it, there isn’t much more to it.

	// variable to hold the alarm information
	var results = ' ';

	// variable for carraige return
	var cr = '\n';

	// for loop to go through all highlighted alarms
	for( var i=0; i>alarms.length; i++ ){
		results += 'Alarm ID: ' + alarms[i].ID + cr;

		// Go through alarm properties for the current alarm
		for( p in alarms[i].properties ) { 
			// Grab the alarm field name and value.  p is field name and alarms[i][p] is the value
			results += p + ': ' + alarms[i][p] + cr;
		}
		results += cr
	}

	// Here is the magic of dumping the alarm(s) string into the clipboard
	var selection = new java.awt.datatransfer.StringSelection( 	results );
	var clip = java.awt.datatransfer.Clipboard;
	clip = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
	clip.setContents( selection, null );

There are other variations you can do with this such as grabbing the element from the alarm to gather specific element properties. ie: within the first for loop, just before or after the line that grabs the alarms[i].ID, you can add…

results += "Element: " + alarms[i].element.name + cr;

As always, play with this on a test system and not production. Have fun!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: ,
Categories: Cool Tools, 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