How To: NetIQ Operations Center Enterprise Alerts via Twitter


 The other day I had one of those "hmmmm, I wonder" moments. My teenage daughter tends to use Twitter more than Facebook. When a tweet comes in, her phone chimes and she starts clicking away. I then starting thinking about Operations Center monitoring the enterprise and having tweets come to my phone when critical services are having an issue. My initial thought was that... sure, I bet with a few hours work building the code, an automation could be put in place on Operations Center to automatically tweet. Guess wasn't really that hard, see the screen shot below.

The first thing of importance was creating a Twitter account for the IT staff, I created an account called "OpsBoard". I made the account private so the tweets (which could be sensitive) were not available to everyone on the internet. One of the IT admins could manage the account and approve other corporate IT staff to follow the OpsBoard account.


I looked around at the API options to integrate with twitter. I wanted an easy solution. Since right clicks and automations in Operations Center are in java script with an ability to access pure java, I was leaning that way. Twitter has a lot of details on their API, almost to much. I was looking for the short cut to just get it working. I found a SOAP option, but wasn't interested. I dug around a little more and ran across Twitter4J . While this is an unofficial java library for Twitter, I found it very easy to use.

One of the requirements for building an API integration with Twitter is you are required to do some additional set up on Twitter. I had to login into my OpsBoard account on and use the Create an App link, to create an application to start using the Twitter API. I named my App "OpsCenterTweet" and set it to Read and Write. After that it was a matter of pressing the button (OAuth tool) to get keys created (Consumer Key, Consumer Secret, Access Token & Access Token Secret). These keys are required for the application to login and perform tweets.

So I've created a private Twitter account, set up an Application in Twitter in order to get my keys and the account is set up for read and write. The next thing to do is build the app.

I was on one of my home computers so I download NetBeans, this is an easy to use Editor/Compiler for java. Based on the Googling around I did, it looks like I need about five lines of code to issue a tweet.

ConfigurationBuilder confbuilder = new ConfigurationBuilder();
confbuilder.setOAuthAccessToken( accessToken ).setOAuthAccessTokenSecret( accessTokenSecret ).setOAuthConsumerKey( consumerKey ).setOAuthConsumerSecret( consumerKeySecret );
Twitter twitter = new TwitterFactory(;
Status status = twitter.updateStatus(message);

After downloading the Twitter4J, creating a project in NetBeans, putting the code in place, it pretty much worked right away. I adjusted the code to make it easier to call from an Operations Center right click and/or automation. The next step was to set up a right-click (serverscript) to test it. I had to place the twitter4j files in the classes\ext directory and the app I wrote in the classes directory. I then created the following right click. (I changed my keys/tokens)

// set up tweet message
var tweetMsg = " is at " element.condition " condition";
// set keys/tokens
var twt = new Packages.tweet.Tweet(); twt.setAccessToken( "111111111-0DjmfdBtWOWdq1HuXoX1ALnmpT2fKUy80sFPXVd3" );
twt.setAccessTokenSecret( "AbC123XyZPdQbUZ5M6uX4gewgvTNsHrbmOgnrWZto" );
twt.setConsumerKey( "AbCPDW17P3HKyjLtAg" );
twt.setConsumerKeySecret( "vASCHFXyzPDQtvOyfLdu2X0aWVJ123G2vnAY" );

// time to tweet
twt.postToTwitter( tweetMsg );

The idea of the script is to grab some content from Operations center first with the "var tweetMsg" line, essentially, grab the element and the condition. Next set my Account/App specific keys/tokens and then finally, call postToTwitter() with my tweet message.

There are enough details here for you to try things out, but there are other details that need to be addressed.

  1. Twitter apparently will allow the tweets, but potentially there is a limit on the amount of tweets per minute, hour, day or something like that. If you think you might run into whatever this limit is, apparently there is a way to request to be whitelisted so you are not throttled (IE: tweets ignored and not posted).

  • If you set this up as an automation to fire when critical Business Services go critical (which is what I envisioned), during start up of Operations Center, the tweeting my get a little noisy. You may need to think of a way on the java script side to wait until the Operations Center server is up and running and settled down (IE: look at the uptime of the Administration/Server element to be more than n before tweeting).

  • Other details such as alarms could be posted, make sure you triple test everything to make sure you are not creating a performance bottleneck on the server and everything works for all the different situations that might happen (IE: accessing alarms when no alarms exist).

  • There is a limit on the amount of characters per tweet. My app does not do any trimming of characters and I have not tested what will happen if you tweet something past the limit.

  • Make sure you change the Access and Consumer keys in the java script above. Just in case you don't, I changed them enough that it won't work with my account

  • Lastly, this is a customization that you as the customer are putting in place. Support can only help with the basics of it, Consulting may be required to assist you with the full design/requirements.

Use at your own risk, some assembly required, batteries not included, your results may vary. LOL



Chris Seamons
Micro Focus Community Management
If you find this post useful, give it a 'Like' or use 'Verify Answer'.


How To-Best Practice
Comment List
Related Discussions