GenericDBCollectord

Overview

The Unified Assurance Metric Generic Database Collector runs a customizable database query and process the results into metrics. This application utilizes rules for maximum flexibility and customization capability.

The default query and rules will poll the Unified Assurance Event database and get a count of the number of events per severity level, then save the results as metrics. Other functionality is also possible, but will require changes to the query that is used and to the rules to process the resulting data.

Generic Database Collector Setup

  1. Review the query in the SelectSQLFile file referenced in the configuration to see the data that will be selected for processing. Update the query as needed.

  2. 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 above.

    Update the logic as needed.

  3. Enable the default Service, unless a specific configuration option is needed:

    Configuration -> Broker Control -> Services

Default Service

Field Value
Package Name coreCollection-app
Service Name Metric Database Collector
Service Program bin/core/collection/GenericDBCollectord
Service Arguments
Service Description Metric rules-based database collector
Failover Type Standalone (Supported: Standalone, Primary/Backup)
Status Disabled
Privileged (Checked)

Default Configuration

Name Value Possible Values Notes
BaseRules collection/metric/db/base.rules Text, 255 characters Relative path to Base Rules.
BranchDir core/default Text, 255 characters relative path to Rules dir.
CheckTime 900 Integer How often (in seconds) where the application checks to see if there are any relevant changes.
IncludeRules collection/metric/db/base.includes Text, 255 characters Relative path to Include Rules.
LoadRules collection/metric/db/base.load Text, 255 characters Relative path to Load Rules.
LogFile logs/MetricDBCollector.log Text, 255 characters Relative path to Log File.
LogLevel ERROR OFF, FATAL, ERROR, WARN, INFO, DEBUG Logging level used by application.
PollTime 300 Integer How often the collector will start a poll cycle, in seconds.
SelectSQLFile collection/metric/db/base.sql Text, 255 characters Relative path to SQL file containing database query.
SourceSchemaName Events Text, 255 characters Database Schema name matching an entry in the Databases configuration; Connects and supports failover as per that configuration. Cannot be used in conjunction with "DatabaseID".
Threads 3 Integer Number of process threads created. The aggregator takes a third of this value (rounded up) for database threads unless overridden by the "DBThreads" application configuration.
DatabaseID Text, 255 characters Optional - Specific Database entry in the Databases configuration. Connects but does not support failover. Cannot be used in conjunction with "SourceSchemaName"
DBThreads Integer Optional - Number of database threads to be created. If not specified, defaults to a third (rounded up) of "Threads" application configuration.
ThresholdThreads Integer Optional - Number of threshold threads to be created. Enables the checking of thresholds in the application instead of the Default Threshold Engine. If not specified, application threshold checking is disabled.
SendAllViolations Disabled Enabled/Disabled Optional - If enabled, thresholds will send violation notifications every poll cycle rather than only on state change. Requires 'ThresholdThreads'
DSN Text, 255 characters Optional - Details the database connection information and driver. DEPRECATED - Use SourceSchemaName or DatabaseID
Password Text, 255 characters Optional - Database login password. DEPRECATED - NOT ENCRYPTED, Use the Database configuration password
Username Text, 255 characters Optional - Database login username. DEPRECATED - Use the Database configuration username

Best Practices

The following list shows you the best practices when using this collector.

Rules

This collector uses the Unified Assurance standard rules architecture, which are 100% Perl syntax. Refer to the following articles to assist in rules creation:

Tokens

The collector exposes the following tokens for rules processing.

Token Description
$Message Hash reference to data row from query. Use $Message->{'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.

Administration Details

The following list shows the technical details you will need for advanced administration of the application: