SnmpCollector

The SnmpCollector collects performance data through the SNMP protocol. Configure access to the SNMP agent through the SNMP configuration in the Web UI (Admin>Configure SNMP Community Names by IP Address).

Collector Facts

Class Name

org.opennms.netmgt.collectd.SnmpCollector

Package

core

Supported on Minion

Yes

Collector Parameters

Use these parameters used in the collectd-configuration.xml file.

Table 1. Collector-specific parameters for the SnmpCollector
Parameter Description Required Default value

collection

The name of the SNMP Collection to use.

required

default

thresholding-enabled

Whether collected performance data should be tested against thresholds.

optional

true

timeout

Timeout in milliseconds to wait for SNMP responses.

optional

SNMP configuration

SNMP Collection Configuration

Understanding resource types helps when editing collector-specific configuration files.

Define SNMP collection in etc/datacollection-config.xml and etc/datacollection.d/*.xml.

<?xml version="1.0"?>
<datacollection-config rrd-repository="/var/lib/opennms/rrd/snmp/">(1)
    <snmp-collection name="default"(2)
                     snmpStorageFlag="select">(3)
        <rrd step="300">(4)
            <rra>RRA:AVERAGE:0.5:1:2016</rra>
            <rra>RRA:AVERAGE:0.5:12:1488</rra>
            <rra>RRA:AVERAGE:0.5:288:366</rra>
            <rra>RRA:MAX:0.5:288:366</rra>
            <rra>RRA:MIN:0.5:288:366</rra>
        </rrd>

        <include-collection dataCollectionGroup="MIB2"/>(5)
        <include-collection dataCollectionGroup="3Com"/>
        ...
        <include-collection dataCollectionGroup="VMware-Cim"/>
    </snmp-collection>
</datacollection-config>
1 Directory where to persist RRD files on the file system, ignored if NewTS is used as time-series storage.
2 Name of the SNMP data collection referenced in the collection package in collectd-configuration.xml.
3 Configure SNMP MIB-II interface metric collection behavior: all means collect metrics from all interfaces, primary only from interface provisioned as primary interface, select only from manually selected interfaces from the Web UI.
4 RRD archive configuration for this set of performance metrics, ignored when NewTS is used as time series storage.
5 Include device- or application-specific performance metric OIDS to collect.
01 snmp datacollection configuration
Figure 1. Configuration overview for SNMP data collection

SNMP Data Collection Parsing Example

This section relates to the SNMP collector, since datacollection-config.xml builds snmp-collections.

Scenario

a) Node A belongs to categories CatA and CatB, and it has a sysObjectID of .1.100.1.1

b) Node B belongs to category CatB, and it has a sysObjectID of .1.100.1.2

Be aware of the distinction between the following two concepts:

  1. Build the effective snmp-collection based on the systemDef list associated with a given list of datacollection-groups.

  2. Build the effective list of mibObj to collect from a given node using its sysObjectID.

The first process starts when the spring context initializes. It also happens during runtime when a change in datacollection-config.xml is detected (not the files in the datacollection directory).

The second process starts every time the SNMP collector will collect data from the node.

Categories and filters require different Collectd packages, in collectd-configuration.xml:

<package name="package-1" remote="false">
 <filter>catincCatA</filter>
 <service name="SNMP" interval="300000" user-defined="false" status="on">
  <parameter key="collection" value="group1"/>
 </service>
</package>
<package name="package-2" remote="false">
 <filter>catincCatB</filter>
 <service name="SNMP" interval="300000" user-defined="false" status="on">
  <parameter key="collection" value="group2"/>
 </service>
</package>

The following in datacollection-config.xml:

<snmp-collection name="group1" snmpStorageFlag="select">
   <rrd step="300">
     <rra>RRA:AVERAGE:0.5:1:2016</rra>
   </rrd>
   <include-collection dataCollectionGroup="UniqueA"/>
   <include-collection dataCollectionGroup="UniqueB"/>
</snmp-collection>
<snmp-collection name="group2" snmpStorageFlag="select">
   <rrd step="300">
     <rra>RRA:AVERAGE:0.5:1:2016</rra>
   </rrd>
   <include-collection dataCollectionGroup="UniqueB"/>
   <include-collection dataCollectionGroup="UniqueC"/>
</snmp-collection>

Then, inside the datacollection directory, would be three files, for example, unique-a.xml, unique-b.xml, and unique-c.xml, with the following content, respectively:

<datacollection-group name="UniqueA">
  <systemDef name="Collect-A">
   <sysoid>.1.100.1.1</sysoid>
   <collect>
     <includeGroup>test-group-1</includeGroup>
   </collect>
  </systemDef>
  <systemDef name="Collect-B">
   <sysoid>.1.100.1.2</sysoid>
   <collect>
     <includeGroup>test-group-2</includeGroup>
   </collect>
  </systemDef>
  <systemDef name="Collect-C">
   <sysoidMask>.1.100.</sysoidMask>
   <collect>
     <includeGroup>test-group-3</includeGroup>
   </collect>
  </systemDef>
</datacollection-group>
<datacollection-group name="UniqueB">
  <systemDef name="Collect-D">
   <sysoidMask>.1.100.1.</sysoidMask>
   <collect>
     <includeGroup>test-group-4</includeGroup>
   </collect>
  </systemDef>
  <systemDef name="Collect-E">
   <sysoid>.1.100.1.3</sysoid>
   <collect>
     <includeGroup>test-group-5</includeGroup>
   </collect>
  </systemDef>
  <systemDef name="Collect-F">
   <sysoidMask>.1.100.1.</sysoidMask>
   <collect>
     <includeGroup>test-group-6</includeGroup>
   </collect>
  </systemDef>
</datacollection-group>
<datacollection-group name="UniqueC">
  <systemDef name="Collect-G">
   <sysoidMask>.1.</sysoidMask>
   <collect>
     <includeGroup>test-group-7</includeGroup>
   </collect>
  </systemDef>
  <systemDef name="Collect-H">
   <sysoid>.1.100.3.1</sysoid>
   <collect>
     <includeGroup>test-group-8</includeGroup>
   </collect>
  </systemDef>
  <systemDef name="Collect-I">
   <sysoid>.1.100.1.1.2</sysoid>
   <collect>
     <includeGroup>test-group-9</includeGroup>
   </collect>
  </systemDef>
</datacollection-group>

As mentioned, there will be two effective snmp-collections called group1 and group2, as the SNMP service appears twice in collectd-configuration.xml. Each one matches a different set of nodes.

Because all the systemDefs have unique names, group1 will contain UniqueA plus UniqueB, meaning it would have Collect-A through Collect-F. Similarly, group2 would contain Collect-D through Collect-I. Regardless of the sysoid and sysoidMasks inside the systemDef, what matters at this level is the systemDef name.

For node A

Because it matches two collectd packages for the SNMP service, the collector uses both collections (group1 and group2). It will check Collect-A through Collect-I. Note that even if UniqueB is referenced twice, it will be included once.

Now, as the node’s sysObjectID is .1.100.1.1, only the systemDefs Collect-A, Collect-C, Collect-D, Collect-F, and Collect-G will be included, as those are the only ones with a sysoid or sysoidMask that matches the sysObjectID.

However, it will add the mibObj groups in the order they appear. If one systemDef references a group already included, it won’t add it again (knowing the groups are done by checking their names).

The idea is to extract the list of systemDefs that match the sysObjectID, to get the list of mibObj groups, to finally get the list of OIDs to retrieve via SNMP.

For node B

Because it matches one collectd package for the SNMP service, the collector uses one collection (group2). It will check Collect-D through Collect-I.

Now, as the node’s sysObjectID is .1.100.1.2, only the systemDefs Collect-D, Collect-F, and Collect-G will be included.

SnmpCollectorNG

The SnmpCollectorNG provides an alternate implementation to the SnmpCollector that takes advantages of new APIs in the platform. It is provided as a separate collector while we work to validate its functionality and run-time characteristics, with the goal of eventually having it replace the SnmpCollector.

Use this new collector by updating existing references from org.opennms.netmgt.collectd.SnmpCollector to org.opennms.netmgt.collectd.SnmpCollectorNG.

Known caveats include:

  • No support for alias type resources

  • No support for min/max values