Netcool Event Enrichment

Table of Contents

One of the common tasks while working with Netcool events is to enrich them by updating some of the event's properties with data retrieved from another system. We provide two sample enrichment implementations with the Netcool plugin for RapidOSS so that implementing enrichment is as easy as tweaking the sample scripts provided.

These samples assume that the data to be looked up resides in a MYSQL database. Make necessary changes once you are familiar with this sample implementation.

Lookup Data for Enrichment

In our sample scenario, the data to be looked up for enrichment is stored in a MYSQL database.
DeviceSla table

name slaLevel location status contact
device1 Gold Paris Down Joe

Two Enrichment Scenarios

The difference between the two implementations is where the look up data is retrieved for each Netcool event processed:

  1. "Lookup from Database" scenario will perform the look up from the database for each event
  2. "Lookup from RapidOSS" scenario will perform the look up from RapidOSS for each event, assuming that a database connector populates RapidOSS with data to be looked up. There may be various reasons for bringing the lookup data to RapidOSS, such as, increasing the system's performance by replacing a potentially slower lookup to the database by a faster local RapidOSS lookup.

"Lookup from Database" Scenario

Here are the steps for the first enrichment implementation:

  1. Netcool connector: An instance of the connector, pointing to the Netcool server, will be created from the admin UI.
  2. Database Connection and Datasource definition from the admin UI. This will point to the database server to retrieve data.
  3. Enrichment processor script - to do the lookup in database and then update events in Netcool (RS_HOME/RapidSuite/operations/EnrichmentProcessor.groovy).

EnrichmentProcessor Script

This script has 2 responsibilities:

  1. By using the elementName property of the Netcool event passed in as argument, use the SingleTableDatabaseDatasource to retrieve the row corresponding to the specified device name (getRecord call)
  2. Update the Netcool event's summary property with the retrieved slaLevel and status values, by using the Netcool Datasource (of the NetcoolConnector).

enrichFromDb operation of EnrichmentProcessor script implements this functionality.

In EnrichmentProcessor.groovy, user needs to set "enrichUsingRIDataFlag" variable to false if the lookup is going to be from Database.
FurtherMore, since database lookup is going to be used, "datasourceName" variable needs to be assigned to proper singletable database datasource name.
When the "enrich()" operation is called (RsEvent calls EnrichmentProcessor.eventIsAdded which in turn calls enrich operation) it will dispatch the call to enrichFromDb() according to the value of the "enrichUsingRIDataFlag" variable.

"Lookup from RapidOSS" Scenario

This scenario assumes that we will store database data in a model class called DeviceSla. Make necessary changes for your own implementation.

Here are the steps for the second enrichment implementation:

  1. Netcool connector: An instance of the connector, pointing to the Netcool server, will be created from the admin UI
  2. Database Connection and Datasource definition from the admin UI. This will point to the database server to retrieve data.
  3. EnrichmentModelConfiguration.xml to define a new application class (DeviceSla). This class will be used to store DeviceSla data retrieved from the database. Run modelCreator script and reload application to add DeviceSla modeled class to RapidOSS.
  4. database connector script to retrieve lookup data from the database to RapidOSS (RS_HOME/RapidSuite/scripts/enrichmentDbConnector.groovy)
  5. Enrichment processor script - to do the lookup in RapidOSS and then update events in Netcool (RS_HOME/RapidSuite/operations/EnrichmentProcessor.groovy)
    In EnrichmentProcessor.groovy, user needs to set "enrichUsingRIDataFlag" variable to true if the lookup is going to be from RapidOSS.
    When the "enrich()" operation is called (RsEvent calls EnrichmentProcessor.eventIsAdded which in turn calls enrich operation) it will dispatch the call to enrichFromRI() method according to the value of the "enrichUsingRIDataFlag" variable.

Database Connector Script

This script will periodically retrieve all rows of the DeviceSla table into RapidOSS my creating instances of DeviceSla model. It is possible to retrieve only the updated rows at each polling of the database, if the table supports identifying recent inserts or updates (via a timestamp field). In the sample scenario, table structure has no timestamp column and the data is small enough to make it feasible to retrieve all rows at every poll. The data can also reside somewhere other than a database. In this case another type of connector should be used.

EnrichmentProcessor Script

This script has 2 responsibilities:

  1. By using the elementName property of the Netcool event passed in as argument, perform a get operation from RapidOSS repository for the corresponding Device instance
  2. Update the Netcool event's summary property with the slaLevel and status of the Device, by using the Netcool Datasource.

enrichFromRI operation of enrichment script implements this functionality.

Installation of Enrichment Module

  1. Copy all files under RS_HOME/solutions/enrichment to RS_HOME/RapidSuite.
  2. Modify EventProcessor to make sure that afterProcessors list contains "EnrichmentProcessor".
    static def afterProcessors=["EnrichmentProcessor"];
  3. To run the sample implementation as is, create the DeviceSla table in a MySQL database and populate it with sample data. See the groovy code excerpt at the end of this page.
  4. Copy mysql jdbc driver (mysql-connector-java-3.1.8-bin.jar) into the RS_HOME/RapidSuite/lib directory
  5. In order to execute second scenario where data is retrieved into the DeviceSla model of RapidOSS, generate the DeviceSla modeled class. Run modelCreator script.See Activating Modeling Changes section of the Modeling document for details on how to generate a new modeled class.
  6. Restart RapidOSS
def prepareDBTables(){
	def dsConn = DatabaseConnection.get(name:"mysql");
	if(dsConn == null){
	    dsConn = DatabaseConnection.add(name:"mysql", driver:"com.mysql.jdbc.Driver",url:"jdbc:mysql://localhost/test", username:"root", userPassword:"root");
	}

	def dbDs = DatabaseDatasource.add(connection:dsConn,name:"DMNDB");

	try{
	    dbDs.runUpdate("drop table deviceSla");
	}
	catch(e){}

	dbDs.runUpdate("create table deviceSla (ID int(11) NOT NULL,NAME varchar(50) NOT NULL,SLALEVEL varchar(20), LOCATION varchar(50), STATUS varchar(10), CONTACT varchar(50), PRIMARY KEY  (ID));");

	dbDs.runUpdate("INSERT INTO deviceSla (id, name, slalevel, location, status, contact) VALUES(1,'router1', 'gold', 'paris', 'down', 'david')");
	dbDs.runUpdate("INSERT INTO deviceSla (id, name, slalevel, location, status, contact) VALUES(2,'router2', 'gold', 'paris', 'down', 'david')");
	dbDs.runUpdate("INSERT INTO deviceSla (id, name, slalevel, location, status, contact) VALUES(3,'switch1', 'gold', 'london', 'available', 'joe')");
	dbDs.runUpdate("INSERT INTO deviceSla (id, name, slalevel, location, status, contact) VALUES(4,'switch2', 'silver', 'london', 'down', 'joe')");
	dbDs.runUpdate("INSERT INTO deviceSla (id, name, slalevel, location, status, contact) VALUES(5,'host1', 'gold', 'dallas', 'down', 'jill')");
	dbDs.runUpdate("INSERT INTO deviceSla (id, name, slalevel, location, status, contact) VALUES(6,'host2', 'silver', 'dallas', 'available', 'jill')");

}
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.