FileCollectord

The Oracle Communications Unified Assurance Metric File Collector tails a local file and processes any lines written to the file through rules, the results of which can be saved as metrics which can then be compared for thresholding. This collector is device and instance oriented.

Note:

Only lines that are written to the file while the collector is running will be processed.

You can run this application as a service using the Services UI.

File Collector Setup

  1. Update the application configuration to read the correct data file.

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

    Configuration -> Broker Control -> Services

Default Service

The following table shows the settings for the default service. Actual values are in bold, descriptions of values are in plaintext.

Field Value
Package coreCollection-app
Name Metric File Collector
Program bin/core/collection/FileCollectord
Arguments This field is blank. There is no default value.
Description Metric rules-based file collector
Failover Type Standalone (Supported: Standalone, Primary, Redundant/Backup)
Status Disabled
Privileged This option is selected.

See Services in Unified Assurance User's Guide for general information about the settings for services.

See Using Application Primary/Backup Failover for more information about the different failover types.

Default Configuration

The following table shows the default configurations for the application. Actual values are in bold, descriptions of values are in plaintext.

Name Default Value Possible Values Notes
BaseRules collection/metric/file/base.rules Text, 255 characters The relative path to the application Base Rules file.
BranchDir core/default Text, 255 characters The relative path to the rules directory.
CheckTime 900 An integer How often (in seconds) where the application checks to see if there are any relevant changes.
File var/metrics.log Text, 255 characters The file to be tailed. - NO RELOAD CONFIG SUPPORT.
IncludeRules collection/metric/file/base.includes Text, 255 characters The relative path to the application Include Rules file.
LoadRules collection/metric/file/base.load Text, 255 characters The relative path to the application Load Rules file.
LogFile logs/MetricFileCollector.log Text, 255 characters The relative path to the log file.
LogLevel ERROR OFF, FATAL, ERROR, WARN, INFO, DEBUG The logging level for the application.
Threads 3 An integer Number of process threads created. The collector takes a third of this value (rounded up) for database threads unless overridden by the DBThreads application configuration.
DBThreads This field is blank. There is no default value. An integer (Optional) Number of database threads to be created. If not specified, defaults to a third (rounded up) of Threads application configuration.
SendAllViolations Disabled Enabled or Disabled (Optional) If enabled, thresholds will send violation notifications every poll cycle rather than only on state change. Requires 'ThresholdThreads'.
ThresholdThreads This field is blank. There is no default value. An 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.

Rules

This collector uses the Unified Assurance standard rules architecture in Perl syntax. For information about creating rules, see the following in Unified Assurance Developer's Guide:

Tokens

The collector exposes the following tokens for rules processing.

Token Description
$Message->{line} The data received from the collector.
$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, a comma separated list of response time metric data is being written to a file in the following format:

Time,DNS,IP,Instance,Value,Status

Here is the code that could be used to process the data:

# Split the line from the tailed file at each comma and save the values in @Fields
@Fields = split(/,/, $Message->{line});

# Variables used in creating Instance and Metric
my $DeviceID     = 0;
my $InstanceID   = 0;
my $MetricID     = 0;
my $MetricTypeID = 90;
my $Factor       = 1;
my $Maximum      = 0;
my $Interval     = 300;
my $Error;

# Get the devices DeviceID, if it does not exist in the catalog it will be created
($Error, $Message, $DeviceID) = FindDeviceID({
    DBH         => \$RulesDBH, 
    StorageHash => $MetricHash, 
    DNS         => $Fields[1], 
    IP          => $Fields[2], 
    Create      => 1
});

# Create the Metric Instance
($Error, $Message, $InstanceID) = FindInstanceID({
    DBH         => \$RulesDBH, 
    StorageHash => $MetricHash, 
    Name        => $Fields[3], 
    DeviceID    => $DeviceID, 
    TypeID      => 0, 
    Create      => 1
});

# Create the Metric
($Error, $Message, $MetricID) = FindMetricID({
    DBH          => \$RulesDBH, 
    StorageHash  => $MetricHash, 
    DeviceID     => $DeviceID, 
    InstanceID   => $InstanceID, 
    MetricTypeID => $MetricTypeID, 
    Factor       => $Factor, 
    Max          => $Maximum, 
    PollInterval => $Interval, 
    Create       => 1
});

# Insert the metric in the queue to prepare for insertion
if (int($MetricID) > 0) {
    $DataQueue->enqueue($MetricID . ':' . $Fields[4] . ':' . $Fields[5] . ':' . $Fields[0]);
}

Administration Details

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