Netcool Connector Details

Table of Contents

This documents provides detailed information on how the connector retrieves data from the Netcool server and how its behavior can be modified.

When a new connector is created, a default scheduled script is created with the name you have supplied for the connector. For example, if you have created a connector named "ncServer", the name of the scheduled script will be "ncServer". It will be scheduled for a periodic execution, which is by default every 30 seconds. This can be changed by editing the connector script properties in the Scripts tab. You can also modify the logging options such as log file name, log level for the the connector script in same tab in admin UI. For more details, please refer to Scripting document.

The actual script files used for the Netcool connector can be found in RS_HOME/RapidSuite/scripts folder:

  • netcoolConnector.groovy
  • NetcoolConnectorImpl.groovy

In netcoolConnector.groovy file, an instance of a NetcoolConnectorImpl class is created for this particular connector, unless one already exists.

"StateChange" column in Netcool alerts.status table is used to identify the newly updated/added records. The value for the last updated record in the RapidOSS repository is kept in NetcoolLastRecordIdentifier model. By getting records from the Netcool database since the lastRecordIdentifier value, we process new, and modified records. Also, a column is assumed to be designated to tag the deleted records. Among the records which are retrieved from Netcool database, those records with the deleted tag on are cleared from the repository.

def processEvents()
    {

        NetcoolLastRecordIdentifier lastRecordIdentifier = NetcoolLastRecordIdentifier.get(connectorName: connectorName);
        if (lastRecordIdentifier == null)
        {
            lastRecordIdentifier = NetcoolLastRecordIdentifier.add(connectorName: connectorName, eventLastRecordIdentifier: 0, journalLastRecordIdentifier: 0);
        }
        def deleteMarkerNetcoolName = deleteMarkerField ? deleteMarkerField.netcoolName : "Severity"
        def lastEventStateChange = lastRecordIdentifier.eventLastRecordIdentifier;
        logger.info("Processing events. after ${lastEventStateChange}");
        def whereClause = "StateChange > ${lastEventStateChange} AND StateChange <= getdate - 1";
        List records = datasource.getEvents(whereClause);
        logger.info("Got ${records.size()} number of records");
        for (Map rec in records) {
            if (rec[deleteMarkerNetcoolName] == "0") {
                logger.info("Clearing event ${rec}")
                def event = NetcoolEvent.get(name: "${rec.SERVERNAME}_${rec.SERVERSERIAL}");
                if (event) {
                    event.clear();
                }
            }
            else {
                logger.info("Adding event ${rec}");
                def eventProps = getEventProperties(rec);
                logger.info("Event properties are ${eventProps}");
                def res = invokeMethod(NetcoolEvent, "add", [eventProps] as Object[]);
                if (!res.hasErrors())
                {
                    logger.info("Event added.");
                    def lastStateChange = rec.statechange;
                    if (lastStateChange > lastEventStateChange) {
                        lastEventStateChange = lastStateChange;
                    }
                }
                else
                {
                    logger.warn("Could not add event with serial ${rec.SERVERSERIAL}. Reason :${res.errors}");
                }
            }

        }
        lastRecordIdentifier.eventLastRecordIdentifier = lastEventStateChange;
    }

The algorithms in NetcoolConnectorImpl class can be modified if the connector is required to have a different logic to identify new/modified records and process them.

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