SNMP Profiles

SNMP Profiles are prefabricated sets of SNMP configuration that are automatically "fitted" against eligible IP addresses at provisioning time. Each profile may have a unique label and an optional filter expression. If the filter expression is present, it will be evaluated to check whether a given IP address or reverse-lookup hostname passes the filter. A profile with a filter expression will be fitted to a given IP address only if the filter expression evaluates true against that IP address.

SNMP profiles can be added to snmp-config.xml to enable automatic fitting of SNMP interfaces.

Sample snmp-config.xml with profiles
<snmp-config xmlns="" write-community="private" read-community="public" timeout="800" retry="3">
   <definition version="v1" ttl="6000">
      <profile version="v1" read-community="horizon" timeout="10000">
      <profile version="v1" ttl="6000">
         <filter>iphostname LIKE '%opennms%'</filter>
      <profile version="v1" read-community="meridian">
         <filter>IPADDR IPLIKE 172.1.*.*</filter>

In the above config,

  1. profile1 doesn’t have a filter expression. This profile will be tried for every interface.

  2. profile2 has a filter expression that compares iphostname (the hostname resulting from a reverse DNS lookup of the IP address being fitted) against a preconfigured value. This profile’s SNMP parameters will be fitted only against IP addresses whose hostname contains the string opennms.

  3. profile3 has an IPLIKE expression that matches all interfaces in the range specified in the filter. This profile’s SNMP parameters will be fitted only against IP addresses in the range specified by the IPLIKE expression.

Profiles will be tried in the order they are configured. The first match that produces a successful SNMP GET-REQUEST on the scalar instance of sysObjectID will be saved by Provisiond as the SNMP configuration definition to use for all future SNMP operations against the fitted IP address.

default as profile label is reserved for default SNMP config.

Manually fit an SNMP profile

The opennms:snmp-fit Karaf shell command finds a matching profile for a given IP address and prints out the resulting config. Matching or "fitting" an SNMP profile is successful if the IP passes the profile’s filter expression and gets the scalar sysObjectID instance.

$ ssh -p 8101 admin@localhost
admin@opennms()> opennms:snmp-fit -l MINION -s               (1)
admin@opennms()> opennms:snmp-fit profile1                   (2)
admin@opennms()> opennms:snmp-fit -s -n -f Switches profile2 (3)
1 Searches the profiles that fit the IP address at location MINION and saves the resulting configuration as a definition for future use.
2 Checks whether the profile with label profile1 is a fit for IP address, but does not save the resulting configuration if it is a fit.
3 Checks whether the profile labeled profile2 is a fit for IP address If a match, it saves the resulting configuration and also sends a newSuspect event, telling Horizon to auto-provision the node at that IP address into the Switches requisition.

Remove an IP address from definition.

The opennms:snmp-remove-from-definition Karaf shell command removes an IP address from the system-wide SNMP configuration definitions.

$ ssh -p 8101 admin@localhost
admin@opennms()> opennms:snmp-remove-from-definition -l MINION

This removes IP address at location MINION from the system-wide SNMP configuration so that this IP address can be fitted to a new profile. This command is useful when an IP address formerly assigned to a device is reassigned to a device with a different SNMP configuration.

Using SNMP profiles with the SNMP detector

By default, the SnmpDetector does not use SNMP profiles. To enable SNMP profiles for the SnmpDetector, add property useSnmpProfiles to the detector and set it to true. If you use profiles and do not enable this setting, the SNMP service may not get detected on your nodes until the node is added to inventory and rescanned.