Collect SNMP Metrics From Your Network Devices

Installation

Network Device Monitoring relies on the SNMP Integration included in the Datadog Agent package. Ensure you are using Agent v7.32+. No additional installation is necessary.

Configuration

Datadog Network Device Monitoring supports collecting metrics from individual devices, or auto-discovering devices (unique IP addresses) on entire subnets.

Choose your collection strategy based on the number of devices present on your network, and how dynamic your network is (meaning frequency of adding or removing devices):

Regardless of the collection strategy, leverage Datadog’s sysObjectID mapped device profiles to automatically collect relevant metrics from your devices.

Monitoring individual devices

To monitor individual devices:

  • For SNMPv2, configure an instance specifying the IP address and community string of the device:

    init_config:
      loader: core  # use core check implementation of SNMP integration. recommended
      use_device_id_as_hostname: true  # recommended
    instances:
    - ip_address: '1.2.3.4'
      community_string: 'sample-string'  # enclose with single quote
      tags:
        - 'key1:val1'
        - 'key2:val2'
    
  • For SNMPv3, configure an instance specifying the IP address and SNMPv3 credentials of the device (as appropriate), for example: user, authProtocol, authKey, privProtocol, and privKey:

    init_config:
      loader: core  # use core check implementation of SNMP integration. recommended
      use_device_id_as_hostname: true  # recommended
    instances:
    - ip_address: '1.2.3.4'
      snmp_version: 3  # optional, if omitted which version of SNMP you are using is auto-detected
      user: 'user'
      authProtocol: 'SHA256'  # choices: MD5, SHA, SHA224, SHA256, SHA384, SHA512
      authKey: 'fakeKey'  # enclose with single quote
      privProtocol: 'AES256'  # choices: DES, AES, AES192, AES192C, AES256, AES256C
      privKey: 'fakePrivKey'  # enclose with single quote
      tags:
        - 'key1:val1'
        - 'key2:val2'
    

After setup, the Agent collects relevant metrics by matching your devices to one of Datadog’s supported device profiles.

To expand your setup:

  • Add more instances to collect metrics from more devices on your network.
  • Use Autodiscovery if you need to collect metrics from lots of devices across a dynamic network.

Autodiscovery

An alternative to specifying individual devices is to use Autodiscovery to automatically discover all the devices on your network.

Autodiscovery polls each IP on the configured subnet, and checks for a response from the device. Then, the Datadog Agent looks up the sysObjectID of the discovered device and maps it to one of Datadog’s supported device profiles. The profiles contain lists of predefined metrics to collect for various types of devices.

To use Autodiscovery with Network Device Monitoring:

  1. Install or upgrade the Datadog Agent to v7.27+. For platform specific instructions, see the Datadog Agent documentation.

  2. Edit the datadog.yaml Agent configuration file to include all the subnets for Datadog to scan. The following sample config provides required parameters, default values, and examples for Autodiscovery.

network_devices:
  autodiscovery:
    workers: 100  # number of workers used to discover devices concurrently
    discovery_interval: 3600  # interval between each autodiscovery in seconds
    loader: core  # use core check implementation of SNMP integration. recommended
    use_device_id_as_hostname: true  # recommended
    configs:
      - network_address: 10.10.0.0/24  # CIDR subnet
        loader: core
        snmp_version: 2
        port: 161
        community_string: '***'  # enclose with single quote
        tags:
        - "key1:val1"
        - "key2:val2"
      - network_address: 10.20.0.0/24
        loader: core
        snmp_version: 2
        port: 161
        community_string: '***'
        tags:
        - "key1:val1"
        - "key2:val2"
network_devices:
  autodiscovery:
    workers: 100  # number of workers used to discover devices concurrently
    discovery_interval: 3600  # interval between each autodiscovery in seconds
    loader: core  # use core check implementation of SNMP integration. recommended
    use_device_id_as_hostname: true  # recommended
    configs:
      - network_address: 10.10.0.0/24  # CIDR subnet
        snmp_version: 3
        user: 'user'
        authProtocol: 'SHA256'  # choices: MD5, SHA, SHA224, SHA256, SHA384, SHA512
        authKey: 'fakeKey'  # enclose with single quote
        privProtocol: 'AES256'  # choices: DES, AES, AES192, AES192C, AES256, AES256C
        privKey: 'fakePrivKey'  # enclose with single quote
        tags:
          - 'key1:val1'
          - 'key2:val2'
      - network_address: 10.20.0.0/24
        snmp_version: 3
        user: 'user'
        authProtocol: 'SHA256'
        authKey: 'fakeKey'
        privProtocol: 'AES256'
        privKey: 'fakePrivKey'
        tags:
          - 'key1:val1'
          - 'key2:val2'

Note: The Datadog Agent automatically configures the SNMP check with each of the IPs that are discovered. A discovered device is an IP that responds successfully when being polled using SNMP.

Note: Make sure you are on Agent 7.53+ for this syntax. For previous versions, see the previous config_template.yaml

Ping

When configured, the SNMP check can also send ICMP pings to your devices. This can be configured for individual as well as Autodiscovered devices.

Setup

  1. Install or upgrade the Datadog Agent to v7.52+. For platform specific instructions, see the Datadog Agent documentation.

  2. Edit the snmp.d/conf.yaml file in the conf.d/ folder at the root of your Agent’s configuration directory for individual devices, or the datadog.yaml Agent configuration file for Autodiscovery. See the sample snmp.d/conf.yaml for all available configuration options.

  3. Linux Only: If you’re receiving errors when running ping, you may need to configure the integration to send pings using a raw socket. This requires elevated privileges and is done using the Agent’s system-probe. See the linux.use_raw_socket system-probe configuration below.

Note: For Autodiscovery, Datadog does not ping devices that do not respond to SNMP.

  • To apply ping settings to all manually configured devices, add the ping configuration in the init_config section.

        init_config:
          loader: core
          use_device_id_as_hostname: true
        instances:
        - ip_address: '1.2.3.4'
          community_string: 'sample-string'
          tags:
            - 'key1:val1'
            - 'key2:val2'
          ping:
            enabled: true            # (default false) enable the ping check
            linux:                   # (optional) Linux specific configuration
              use_raw_socket: true   # (optional, default false) send pings using a raw socket (see step 3 above)
    
  • To apply ping settings to all Autodiscovery subnets, create the ping configuration under the network_devices.autodiscovery section.

    network_devices:
     autodiscovery:
       workers: 100
       discovery_interval: 3600
       loader: core
       use_device_id_as_hostname: true
       configs:
         - network_address: 10.10.0.0/24
           loader: core
           snmp_version: 2
           port: 161
           community_string: '***'
           tags:
           - "key1:val1"
           - "key2:val2"
           ping:
             enabled: true            # (default false) enable the ping check
             linux:                   # (optional) Linux specific configuration
               use_raw_socket: true   # (optional, default false) send pings using a raw socket (see step 3 above)
    

If you’re on Linux and want to use raw sockets for ping, you must also enable ping in the system-probe configuration file in addition to the Agent configuration.

Edit /etc/datadog-agent/system-probe.yaml to set the enable flag to true.

ping:
  enabled: true

After successfully enabling ping on your network devices, the Ping State column in the UI is enabled, allowing you to see the ping state statuses for your devices:

The status column in the NDM UI showing the Ping state toggle enabled with the ping state status column highlighted

The following are the status names in the Ping State column and their descriptions:

Status nameDescription
UnreachableDevice is unreachable through ping.
UnmonitoredPing has not been configured for this device.
OkDevice is reachable through ping.
N/AThe devices do not support ping.

Metrics collected

The following metrics are made available after enabling ping:

Metric nameDescription
networkdevice.ping.avg_rttAverage round-trip time
networkdevice.ping.reachableDevice reachability status
networkdevice.ping.packet_lossPacket loss percentage
networkdevice.ping.unreachableDevice unreachable status

Validation

Run the Agent’s status subcommand and look for snmp under the Checks section.

Further Reading