GenericSNMPPollerd
Overview
The Unified Assurance Metric Generic SNMP Poller dynamically connects to every device in the Device Catalog that has a valid set of SNMP credentials. If the connection is successful, the poller sends the connection to the rules to retrieve SNMP available data, which can then be saved as metrics. Metrics such as CPU utilization, hard drive utilization and/or memory utilization can be acquired using the SNMP Poller.
A default installation includes a set of rules files for polling a variety of devices from numerous different vendors. The following documentation has information regarding supported devices and other useful information:
Please contact Oracle Communications if there are devices that are not polled by the out-of-the-box Foundation rules.
Generic SNMP Poller Setup
-
Devices must exist in the Device Catalog for this application to be able to function. Devices can be created in several different ways:
-
Using the Device Auto Discovery application (Core Device Auto Discovery). See the application documentation for additional information.
-
Using the Manual Discovery UI:
-
Manually entering all values using the Devices UI:
-
-
Devices must by SNMP discovered for this application to be able to get data from the devices. See the Device SNMP Discovery application (Core Device SNMP Discovery) for additional information.
-
Review the logic in the rules files referenced in the configuration to see the processing that will be done on the devices that are selected:
-
LoadRules will be executed 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 executed for each device that is selected based on the configuration.
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 | Metric Generic SNMP Poller |
Service Program | bin/core/collection/GenericSNMPPollerd |
Service Arguments | |
Service Description | Metric rules-based SNMP poller |
Failover Type | Standalone (Supported: Standalone, Primary/Backup, Cluster) |
Status | Disabled |
Privileged | (Checked) |
Default Configuration
Name | Value | Possible Values | Notes |
---|---|---|---|
BaseRules | collection/metric/snmp/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. |
DeviceZoneID | 1 | Integer | The poller will only poll devices that are in the specific zone. |
IncludeRules | collection/metric/snmp/base.includes | Text, 255 characters | Relative path to Include Rules. |
LoadRules | collection/metric/snmp/base.load | Text, 255 characters | Relative path to Load Rules. |
LogFile | logs/MetricGenericSNMPPoller.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 poller will start a poll cycle, in seconds. |
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. |
TimeOut | 5 | Integer | The time out for the SNMP connection. |
DBThreads | Integer | Optional - Number of database threads to be created. If not specified, defaults to a third (rounded up) of "Threads" application configuration. | |
DeviceGroupID | Integer | Optional - If specified, the poller will only retrieve devices in the specific group. | |
PollByIP | Enabled | Enabled/Disabled | Optional - If enabled, the device IP address will be used to connect to the device instead of the device DNS name. |
PreferIPv4 | Enabled | Enabled/Disabled | Optional - Controls whether or not to prefer IPv4 transport to communicate with Devices. This option is only considered if both IPv4 and IPv6 are available for a device. If this config is missing, IPv6 will be preferred. |
TestMode | Disabled | Enabled/Disabled | Optional - If enabled, enters test read-only mode. While in this mode, logging is into "$A1BASEDIR/<LogFile>.TEST.log", any metrics collected are not inserted into the database, notifications are suppressed, and rules functions become read-only and return test data. Useful for testing rule sets and data collection using real device data in a controlled environment with restricted modifications to the database. NOTE Direct API or database interactions such as through ExecuteQuery() or the Assure1::API library are not limited by TestMode so be aware modifications are still possible via these methods. |
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'. |
Rules
This poller uses the Unified Assurance standard rules architecture, which are 100% Perl syntax. Refer to the following articles to assist in rules creation:
Tokens
The poller exposes the following tokens for rules processing.
Token | Description |
---|---|
$DeviceHash->{PollTime} | Poll Time CurrentTime |
$DeviceHash->{DeviceID} | Unified Assurance DeviceID |
$DeviceHash->{DNS} | DNS name of polled device |
$DeviceHash->{IPv4} | IPv4 address of polled device |
$DeviceHash->{IPv6} | IPv6 address of polled device |
$DeviceHash->{IP} | IP address (possibly v4 or v6) that this system will use for communications based on value of PreferIPv4 application configuration, what addresses are configured on the target device, and what addresses are configured on the local device |
$DeviceHash->{Target} | The preferred target for this poller. If PollByIP is false and $DeviceHash->{DNS} is not empty, $DeviceHash->{Target} will be the same as $DeviceHash->{DNS}. Otherwise $DeviceHash->{Target} will be the same as $DeviceHash->{IP}. If no valid value can be set for this (if {DNS} is empty or PollByIP is set and {IP} is empty) the device will never be polled. |
$PollFlag->down | Take Semaphore on $PollHash |
$PollFlag->up | Release Semaphore on $PollHash |
$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 Integrations
Creating custom rules files
Custom SNMP rules files can be created and used to poll devices using the following basic procedure, but more advanced coding knowledge will likely be needed.
Please contact Oracle Communications if you have devices that are not polled by the Foundation rules.
Polling Network Interfaces
This section will demonstrate the steps necessary to poll for network interface metrics using the Generic SNMP Poller.
Dependencies
- These rules will not create metric entries for the resulting data to be stored. The metric entries must be pre-configured before these rules will store data. See the "Unified Assurance Metric Network Interface Poller" documentation (Metric Network Interface Poller) for more information.
Steps
-
Go to the Rules UI:
-
Expand the folder path: core -> default -> collection -> metric -> snmp
-
Click on the SNMP folder, then click Add -> Add File. Enter the following:
-
File Name => NetworkInterfaces.rules
-
Logic
# Create the variables needed to hold Device and poller information: my $DeviceID = $DeviceHash->{DeviceID}; my $DeviceInfo = $DeviceHash->{DeviceID} . ':' . $DeviceHash->{DNS} . ':' . $DeviceHash->{IP}; my $PollInterval = $AppConfig->{'PollTime'}; my $PolledTime = $DeviceHash->{PollTime}; # Add a log message to let you know you have entered the Network Interface rules: $Log->Message("INFO", 'Running NetworkInterfaces rules on DeviceInfo [' . $DeviceInfo . ']'); # Create the OID hash of the OIDs to poll: my %OIDs = ( 'SysObjectID' => '1.3.6.1.2.1.1.2.0', 'InterfacesTable' => '1.3.6.1.2.1.2.2.1', 'Index' => '1.3.6.1.2.1.2.2.1.1', 'Descr' => '1.3.6.1.2.1.2.2.1.2', 'Name' => '1.3.6.1.2.1.31.1.1.1.1', 'Type' => '1.3.6.1.2.1.2.2.1.3', 'MTU' => '1.3.6.1.2.1.2.2.1.4', 'ifSpeed' => '1.3.6.1.2.1.2.2.1.5', 'MAC' => '1.3.6.1.2.1.2.2.1.6', 'AdminState' => '1.3.6.1.2.1.2.2.1.7', 'OpState' => '1.3.6.1.2.1.2.2.1.8', 'InOctets' => '1.3.6.1.2.1.2.2.1.10', 'InDiscards' => '1.3.6.1.2.1.2.2.1.13', 'InErrors' => '1.3.6.1.2.1.2.2.1.14', 'OutOctets' => '1.3.6.1.2.1.2.2.1.16', 'OutDiscards' => '1.3.6.1.2.1.2.2.1.19', 'OutErrors' => '1.3.6.1.2.1.2.2.1.20', 'QueueLength' => '1.3.6.1.2.1.2.2.1.21', 'HCInOctets' => '1.3.6.1.2.1.31.1.1.1.6', 'HCOutOctets' => '1.3.6.1.2.1.31.1.1.1.10', 'ifHighSpeed' => '1.3.6.1.2.1.31.1.1.1.15', 'ifAlias' => '1.3.6.1.2.1.31.1.1.1.18', 'sysUpTime' => '1.3.6.1.2.1.1.3.0', 'NetSNMPLoadTable' => '1.3.6.1.4.1.2021.10' ); # Query the selected OIDs via SNMP: my $InterfaceInfo = $Session->get_entries( -columns => [ $OIDs{'Descr'}, $OIDs{'ifSpeed'}, $OIDs{'OpState'}, $OIDs{'InOctets'}, $OIDs{'InDiscards'}, $OIDs{'InErrors'}, $OIDs{'OutOctets'}, $OIDs{'OutDiscards'}, $OIDs{'OutErrors'}, $OIDs{'Name'}, $OIDs{'Descr'}, $OIDs{'ifAlias'}, $OIDs{'HCInOctets'}, $OIDs{'HCOutOctets'}, $OIDs{'ifHighSpeed'}, $OIDs{'sysUpTime'}, $OIDs{'Index'} ] ); # Use the GetSNMPIndexes rules function to determine the number of interface indexes. my @Indexes = GetSNMPIndexes($InterfaceInfo); # Loop through each interface and process the data for my $Index (@Indexes) { # Determine which Instance Name to use for the metric. my $IfName = 'IfDescr'; if ($IfName eq "IfName") { $IfName = $InterfaceInfo->{$OIDs{'Name'} . '.' . $Index}; } elsif ($IfName eq "IfDescr") { $IfName = $InterfaceInfo->{$OIDs{'Descr'} . '.' . $Index}; } elsif ($IfName eq "IfAlias") { $IfName = $InterfaceInfo->{$OIDs{'ifAlias'} . '.' . $Index}; } elsif ($IfName eq "IfIndex") { $IfName = 'Interface-' . $Index; } else { #If no InterfaceType set $IfName = $InterfaceInfo->{$OIDs{'Descr'} . '.' . $Index}; } # Use the FindInstanceID function to find/create the instance for the interface. $Log->Message('DEBUG',"Using InstanceName: $IfName"); ($error, $message, $InstanceID) = FindInstanceID({ DBH => \$RulesDBH, StorageHash => $MetricHash, Name => $IfName, DeviceID => $DeviceID, TypeID => 2, Create => 1 }); #Get Interface Maximum my $max = $InterfaceInfo->{$OIDs{'ifSpeed'} . '.' . $Index}; #Verify if ifHighSpeed or ifSpeed should be used as $max if($max == 4_294_967_295) { my $ifHighSpeed = $InterfaceInfo->{$OIDs{'ifHighSpeed'} . '.' . $Index} * 8; $max = $ifHighSpeed * 1_000_000; #High Speed in Mb/s $Log->Message('DEBUG',"Using ifHighSpeed as Maximum, $max"); } ########### Interface Inbound Bandwidth - MetricTypeID = 3 ############## my $Factor = 1; my $MetricTypeID = 3; my $inBits = 0; #Determine if Interface uses 64 or 32 bit counters my $InCounter32Bit = $InterfaceInfo->{$OIDs{'InOctets'} . '.' . $Index}; my $InCounter64Bit = $InterfaceInfo->{$OIDs{'HCInOctets'} . '.' . $Index}; if(defined($InCounter32Bit)) { if(defined($InCounter32Bit) && ($InCounter32Bit !=0) && ($InCounter64Bit == 0)){ $inBits = $InCounter32Bit; } else{ $inBits = $InCounter64Bit; } } else { $inBits = $InCounter32Bit; } #Get value in BPS $inBits *= 8; #Find MetricID ($Error, $Message, $MetricID) = FindMetricID({ DBH => \$RulesDBH, StorageHash => $MetricHash, DeviceID => $DeviceID, InstanceID => $InstanceID, MetricTypeID => $MetricTypeID, Factor => $Factor, Max => $max, PollInterval => $PollInterval, Create => 0 }); if ($MetricID > 0) { #Update Metric Maximum my ($ErrorFlag, $Message) = UpdateMetricMaximum({ DBH => \$RulesDBH, MetricID => $MetricID, Maximum => $max }); if ($ErrorFlag) { $Log->Message('ERROR', "Error Setting Maximum: $Message"); } #Get Number of BPS Increase since last poll $Value = ProcessCounter({ StorageHash => $StorageHash, MetricID => $MetricID, CurrentValue => $inBits, SNMPIndex => $Index }); #Add Threshold To Metric #Inbound Bandwidth Unused my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 49 }); #Inbound Bandwidth Minor my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 52 }); #Spike Prevention if($Value > $max) { $Value = $max; } #Enqueue Data for insertion $Log->Message('DEBUG', "Enqueue: " . $MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); $DataQueue->enqueue($MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); } ########### Interface Outbound Bandwidth - MetricTypeID = 5 ############## my $Factor = 1; my $MetricTypeID = 5; my $outBits = 0; #Determine if Interface uses 64 or 32 bit counters my $OutCounter32Bit = $InterfaceInfo->{$OIDs{'OutOctets'} . '.' . $Index}; my $OutCounter64Bit = $InterfaceInfo->{$OIDs{'HCOutOctets'} . '.' . $Index}; if(defined($OutCounter32Bit)) { if(defined($OutCounter32Bit) && ($OutCounter32Bit !=0) && ($OutCounter64Bit == 0)){ $outBits = $OutCounter32Bit; } else{ $outBits = $OutCounter64Bit; } } else { $outBits = $OutCounter32Bit; } #Get value in BPS $outBits *= 8; #Find MetricID ($Error, $Message, $MetricID) = FindMetricID({ DBH => \$RulesDBH, StorageHash => $MetricHash, DeviceID => $DeviceID, InstanceID => $InstanceID, MetricTypeID => $MetricTypeID, Factor => $Factor, Max => $max, PollInterval => $PollInterval, Create => 0 }); if ($MetricID > 0) { #Update Metric Maximum my ($ErrorFlag, $Message) = UpdateMetricMaximum({ DBH => \$RulesDBH, MetricID => $MetricID, Maximum => $max }); if ($ErrorFlag) { $Log->Message('ERROR', "Error Setting Maximum: $Message"); } #Get Number of BPS Increase since last poll $Value = ProcessCounter({ StorageHash => $StorageHash, MetricID => $MetricID, CurrentValue => $outBits, SNMPIndex => $Index }); #Add Threshold To Metric #Inbound Bandwidth Unused my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 49 }); #Inbound Bandwidth Minor my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 52 }); #Spike Prevention if($Value > $max) { $Value = $max; } #Enqueue Data for insertion $Log->Message('DEBUG', "Enqueue: " . $MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); $DataQueue->enqueue($MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); } ########### Interface Inbound Errors - MetricTypeID = 7 ############## my $Factor = 1; my $MetricTypeID = 7; $max = 0; my $inErrors = $InterfaceInfo->{$OIDs{'InErrors'} . '.' . $Index}; #Find/Create MetricID ($Error, $Message, $MetricID) = FindMetricID({ DBH => \$RulesDBH, StorageHash => $MetricHash, DeviceID => $DeviceID, InstanceID => $InstanceID, MetricTypeID => $MetricTypeID, Factor => $Factor, Max => $max, PollInterval => $PollInterval, Create => 0 }); if ($MetricID > 0) { #Get Number of InError increases since last poll $Value = ProcessCounter({ StorageHash => $StorageHash, MetricID => $MetricID, CurrentValue => $inErrors, SNMPIndex => $Index }); #Add Threshold To Metric #Inbound Errors High my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 41 }); #Enqueue Data for insertion $Log->Message('DEBUG', "Enqueue: " . $MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); $DataQueue->enqueue($MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); } ########### Interface Outbound Errors - MetricTypeID = 8 ############## my $Factor = 1; my $MetricTypeID = 8; $max = 0; my $outErrors = $InterfaceInfo->{$OIDs{'OutErrors'} . '.' . $Index}; #Get Number of OutError increases since last poll #Find/Create MetricID ($Error, $Message, $MetricID) = FindMetricID({ DBH => \$RulesDBH, StorageHash => $MetricHash, DeviceID => $DeviceID, InstanceID => $InstanceID, MetricTypeID => $MetricTypeID, Factor => $Factor, Max => $max, PollInterval => $PollInterval, Create => 0 }); if ($MetricID > 0) { $Value = ProcessCounter({ StorageHash => $StorageHash, MetricID => $MetricID, CurrentValue => $outErrors, SNMPIndex => $Index }); #Add Threshold To Metric #Outbound Errors High my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 43 }); #Enqueue Data for insertion $Log->Message('DEBUG', "Enqueue: " . $MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); $DataQueue->enqueue($MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); } ########### Interface Inbound Discards - MetricTypeID = 9 ############## my $Factor = 1; my $MetricTypeID = 9; $max = 0; my $inDiscards = $InterfaceInfo->{$OIDs{'InDiscards'} . '.' . $Index}; #Find/Create MetricID ($Error, $Message, $MetricID) = FindMetricID({ DBH => \$RulesDBH, StorageHash => $MetricHash, DeviceID => $DeviceID, InstanceID => $InstanceID, MetricTypeID => $MetricTypeID, Factor => $Factor, Max => $max, PollInterval => $PollInterval, Create => 0 }); if ($MetricID > 0) { #Get Number of InError increases since last poll $Value = ProcessCounter({ StorageHash => $StorageHash, MetricID => $MetricID, CurrentValue => $inDiscards, SNMPIndex => $Index }); #Add Threshold To Metric #Inbound Discards High my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 45 }); #Enqueue Data for insertion $Log->Message('DEBUG', "Enqueue: " . $MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); $DataQueue->enqueue($MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); } ########### Interface Outbound Discards - MetricTypeID = 10 ############## my $Factor = 1; my $MetricTypeID = 10; $max = 0; my $outDiscards = $InterfaceInfo->{$OIDs{'OutDiscards'} . '.' . $Index}; #Find/Create MetricID ($Error, $Message, $MetricID) = FindMetricID({ DBH => \$RulesDBH, StorageHash => $MetricHash, DeviceID => $DeviceID, InstanceID => $InstanceID, MetricTypeID => $MetricTypeID, Factor => $Factor, Max => $max, PollInterval => $PollInterval, Create => 0 }); if ($MetricID > 0) { #Get Number of OutError increases since last poll $Value = ProcessCounter({ StorageHash => $StorageHash, MetricID => $MetricID, CurrentValue => $outDiscards, SNMPIndex => $Index }); #Add Threshold To Metric #Outbound Discards High my ($ErrorFlag, $Message) = AddThresholdToMetric({ DBH => \$RulesDBH, MetricID => $MetricID, ThresholdID => 47 }); #Enqueue Data for insertion $Log->Message('DEBUG', "Enqueue: " . $MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); $DataQueue->enqueue($MetricID . ':' . $Value . ':' . '1' . ':' . $PolledTime); } } $Log->Message("INFO", 'Finished NetworkInterfaces rules on DeviceInfo [' . $DeviceInfo . ']');
-
Click Submit, then enter a commit message, then click OK.
-
-
In the SNMP folder, click on the base.includes file. Add the following line, click Submit, enter a commit message, then click OK:
NetworkInterfaces,collection/metric/snmp/NetworkInterfaces.rules
-
In the SNMP folder, click on the base.rules file. Add the following line, click Submit, enter a commit message, then click OK:
NetworkInterfaces();
-
Go to the Services UI:
-
Select the SNMP Poller, then click Start or Restart.
-
Verify the service starts and metrics are polled.
Administration Details
The following list shows the technical details you will need for advanced administration of the application:
-
Package - coreCollection-app
-
Synopsis -
./GenericSNMPPollerd [OPTIONS]
-
Options:
-c, --AppConfigID N Application Config ID (Service, Job, or Request ID) -?, -h, --Help Print usage and exit
-
Threaded - Multi-Threaded