GenericConnectord
Overview
The Unified Assurance Event Generic Connector is a generic events processing engine that allows you to create custom event enrichment actions via rules. The connector polls the Events database using a custom SQL statement, parsing the results with the customized rules and creating or modifying events within Unified Assurance.
Generic Connector Setup
-
Review the query in the SelectSQLFile file referenced in the configuration to see the events that will be selected for processing. Update the query as needed.
-
Review the logic in the rules files referenced in the configuration to see the processing that will be done on the events that are selected:
-
LoadRules will be run during application startup to load data that might be needed during processing.
-
IncludeRules will be read during application startup to load additional files that might be called during processing.
-
BaseRules will be run for each event that is selected from the query.
Update the logic as needed.
-
-
Enable the default Service, unless a specific configuration option is needed:
Default Service
Field | Value |
---|---|
Package Name | coreCollection-app |
Service Name | Event Generic Database Connector |
Service Program | bin/core/collection/GenericConnectord |
Service Arguments | |
Service Description | Database Connector that performs custom processing on results from a SQL query |
Failover Type | Standalone (Supported: Standalone, Primary/Backup) |
Status | Disabled |
Privileged | (Checked) |
Default Configuration
Name | Value | Possible Values | Notes |
---|---|---|---|
BaseRules | collection/event/generic/base.rules | Text, 255 characters | Relative path to Base Rules. |
BranchDir | core/default | Text, 255 characters | relative path to Rules dir. |
IncludeRules | collection/event/generic/base.includes | Text, 255 characters | Relative path to Include Rules. |
LoadRules | collection/event/generic/base.load | Text, 255 characters | Relative path to Load Rules. |
LogFile | logs/EventGenericDatabaseConnector.log | Text, 255 characters | Relative path to Log File. |
LogLevel | ERROR | OFF, FATAL, ERROR, WARN, INFO, DEBUG | Logging level used by application. |
PollTime | 60 | Integer | How often the connector will poll the database in seconds. |
SelectSQLFile | eventMultiConnector/generic/lookup.sql | Text, 255 characters | Relative path to SQL file containing database query. |
ShardID | 1 | Integer | Database shard to be used. |
Rules
This connector uses the Unified Assurance standard rules architecture in Perl syntax. For information about creating rules, see the following in Unified Assurance Developer's Guide:
-
Core for information about core rules functions.
-
Events for information about Event rules functions.
Tokens
The connector exposes the following tokens for rules processing.
Token | Description |
---|---|
$EventRow | Resulting data from query. Use $EventRow->{'FieldName'} to access the FieldName data. |
$AppConfig | Hash reference to the application configuration name-value pairs that were configured. (i.e. use $AppConfig->{'Host'} to retrieve the set value for 'Host'.) |
$CustomHash | Custom key, value cache available across all rules. Contents commonly defined in Load Rules then used in Base or other rules. NOTE: This variable is a shared object and any additional sub hashes or arrays must be shared before use or it will cause the error: Invalid value for shared scalar. Instantiate the sub hash/array using '&share({})' e.g. $CustomHash->{SubObject} = &share({}); |
$StorageHash | Internal cache used as the StorageHash option when calling rules functions such as FindDeviceID(). NOTE: The structure of this cache is subject to change! Not recommended for custom global storage or manual manipulation; use $CustomHash. |
Example Integration
In this example, the events returned by the default SQL query will be processed. The events returned are ones that have the EscalationFlag field set to 1. For each line returned, a fake ticket number will be generated, and then the Event EscalationFlag, TicketFlag, and TicketID fields are updated. Updating the EscalationFlag will make it so the connector does not try to process the event again and generate duplicate tickets.
my $EventID = $EventRow->{'EventID'};
my $Node = $EventRow->{'Node'};
my $Summary = $EventRow->{'Summary'};
my $EventType = $EventRow->{'EventType'};
my $LastReported = $EventRow->{'LastReported'};
$Log->Message('DEBUG','Running Rules on Event#' . $EventID . ' from Node=[' . $Node . '] and Summary=[' . $Summary . ']');
$Log->Message('WARN', 'Attempting to Open Ticket for EventID=[' . $EventID . ']');
my $TicketNum = int(rand(10000000000));
$Log->Message('WARN', 'Opened Ticket Number = [' . $TicketNum . '] for EventID=[' . $EventID . ']');
my ($ErrorFlag, $Message) = UpdateEvent({
DBH => \$EventDBH,
EventID => $EventID,
ShardID => $AppConfig->{'ShardID'},
Values => {
EscalationFlag => 2,
TicketFlag => 2,
TicketID => $TicketNum
}
});
Administration Details
The following list shows the technical details you will need for advanced administration of the application:
-
Package - coreCollection-app
-
Synopsis -
./GenericConnectord [OPTIONS]
-
Options:
-c, --AppConfigID N AppConfigID => Application Config ID (Service, Job, or Request ID) -?, -h, --Help Print usage and exit
-
Threaded - Single Threaded