Skip to main content

SNMP devices

Plugin: go.d.plugin Module: snmp

Overview

This SNMP collector discovers and gathers statistics for network interfaces on SNMP-enabled devices:

  • Traffic
  • Packets (unicast, multicast, broadcast)
  • Errors
  • Discards
  • Administrative and operational status

Additionally, it collects overall device uptime.

It is compatible with all SNMP versions (v1, v2c, and v3) and uses the gosnmp package.

For advanced users:

  • You can manually specify custom OIDs (Object Identifiers) to retrieve specific data points beyond the default metrics.
  • However, defining custom charts with dimensions for these OIDs requires manual configuration.

This collector is supported on all platforms.

This collector supports collecting metrics from multiple instances of this integration, including remote instances.

Default Behavior

Auto-Detection

This integration doesn't support auto-detection.

Limits

The default configuration for this integration does not impose any limits on data collection.

Performance Impact

Device limitations: Many SNMP switches and routers have limited processing power. They might not be able to report data as frequently as desired. You can monitor response times using go.d.plugin in debug mode to identify potential bottlenecks.

Concurrent access: If multiple collectors or tools access the same SNMP device simultaneously, data points might be skipped. This is a limitation of the device itself, not this collector. To mitigate this, consider increasing the collection interval (update_every) to reduce the frequency of requests.

Metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

The metrics that will be collected are defined in the configuration file.

Per snmp device

These metrics refer to the SNMP device.

Labels:

LabelDescription
sysNameSNMP device's system name (OID: 1.3.6.1.2.1.1.5).

Metrics:

MetricDimensionsUnit
snmp.device_uptimeuptimeseconds

Per network interface

Network interfaces of the SNMP device being monitored. These metrics refer to each interface.

Labels:

LabelDescription
sysNameSNMP device's system name (OID: 1.3.6.1.2.1.1.5).
ifDescrNetwork interface description (OID: 1.3.6.1.2.1.2.2.1.2).
ifNameNetwork interface name (OID: 1.3.6.1.2.1.2.2.1.2).
ifTypeNetwork interface type (OID: 1.3.6.1.2.1.2.2.1.2).

Metrics:

MetricDimensionsUnit
snmp.device_net_interface_trafficreceived, sentkilobits/s
snmp.device_net_interface_unicastreceived, sentpackets/s
snmp.device_net_interface_multicastreceived, sentpackets/s
snmp.device_net_interface_broadcastreceived, sentpackets/s
snmp.device_net_interface_errorsinbound, outbounderrors/s
snmp.device_net_interface_discardsinbound, outbounddiscards/s
snmp.device_net_interface_admin_statusup, down, testingstatus
snmp.device_net_interface_oper_statusup, down, testing, unknown, dormant, not_present, lower_layer_downstatus

Alerts

There are no alerts configured by default for this integration.

Setup

Prerequisites

No action required.

Configuration

File

The configuration file name for this integration is go.d/snmp.conf.

You can edit the configuration file using the edit-config script from the Netdata config directory.

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config go.d/snmp.conf

Options

The following options can be defined globally: update_every, autodetection_retry.

Config options
NameDescriptionDefaultRequired
update_everyData collection frequency.10no
autodetection_retryRecheck interval in seconds. Zero means no recheck will be scheduled.0no
hostnameTarget ipv4 address.yes
communitySNMPv1/2 community string.publicno
options.versionSNMP version. Available versions: 1, 2, 3.2no
options.portTarget port.161no
options.retriesRetries to attempt.1no
options.timeoutSNMP request/response timeout.5no
options.max_repetitionsControls how many SNMP variables to retrieve in a single GETBULK request.25no
options.max_request_sizeMaximum number of OIDs allowed in a single GET request.60no
network_interface_filter.by_nameFilter interfaces by their names using simple patterns.no
network_interface_filter.by_typeFilter interfaces by their types using simple patterns.no
user.nameSNMPv3 user name.no
user.nameSecurity level of SNMPv3 messages.no
user.auth_protoSecurity level of SNMPv3 messages.no
user.nameAuthentication protocol for SNMPv3 messages.no
user.auth_keyAuthentication protocol pass phrase.no
user.priv_protoPrivacy protocol for SNMPv3 messages.no
user.priv_keyPrivacy protocol pass phrase.no
chartsList of charts.[]yes
charts.idChart ID. Used to uniquely identify the chart.yes
charts.titleChart title.Untitled chartno
charts.unitsChart units.numno
charts.familyChart family.charts.idno
charts.typeChart type (line, area, stacked).lineno
charts.priorityChart priority.70000no
charts.multiply_rangeUsed when you need to define many charts using incremental OIDs.[]no
charts.dimensionsList of chart dimensions.[]yes
charts.dimensions.oidCollected metric OID.yes
charts.dimensions.nameDimension name.yes
charts.dimensions.algorithmDimension algorithm (absolute, incremental).absoluteno
charts.dimensions.multiplierCollected value multiplier, applied to convert it properly to units.1no
charts.dimensions.divisorCollected value divisor, applied to convert it properly to units.1no
user.auth_proto

The security of an SNMPv3 message as per RFC 3414 (user.level):

String valueInt valueDescription
none1no message authentication or encryption
authNoPriv2message authentication and no encryption
authPriv3message authentication and encryption
user.name

The digest algorithm for SNMPv3 messages that require authentication (user.auth_proto):

String valueInt valueDescription
none1no message authentication
md52MD5 message authentication (HMAC-MD5-96)
sha3SHA message authentication (HMAC-SHA-96)
sha2244SHA message authentication (HMAC-SHA-224)
sha2565SHA message authentication (HMAC-SHA-256)
sha3846SHA message authentication (HMAC-SHA-384)
sha5127SHA message authentication (HMAC-SHA-512)
user.priv_proto

The encryption algorithm for SNMPv3 messages that require privacy (user.priv_proto):

String valueInt valueDescription
none1no message encryption
des2ES encryption (CBC-DES)
aes3128-bit AES encryption (CFB-AES-128)
aes1924192-bit AES encryption (CFB-AES-192) with "Blumenthal" key localization
aes2565256-bit AES encryption (CFB-AES-256) with "Blumenthal" key localization
aes192c6192-bit AES encryption (CFB-AES-192) with "Reeder" key localization
aes256c7256-bit AES encryption (CFB-AES-256) with "Reeder" key localization

Examples

SNMPv1/2

In this example:

  • the SNMP device is 192.0.2.1.
  • the SNMP version is 2.
  • the SNMP community is public.
  • we will update the values every 10 seconds.
Config
jobs:
- name: switch
update_every: 10
hostname: 192.0.2.1
community: public
options:
version: 2

SNMPv3

To use SNMPv3:

  • use user instead of community.
  • set options.version to 3.
Config
jobs:
- name: switch
update_every: 10
hostname: 192.0.2.1
options:
version: 3
user:
name: username
level: authPriv
auth_proto: sha256
auth_key: auth_protocol_passphrase
priv_proto: aes256
priv_key: priv_protocol_passphrase

Custom OIDs

In this example:

  • the SNMP device is 192.0.2.1.
  • the SNMP version is 2.
  • the SNMP community is public.
  • we will update the values every 10 seconds.
Config
jobs:
- name: switch
update_every: 10
hostname: 192.0.2.1
community: public
options:
version: 2
charts:
- id: "bandwidth_port1"
title: "Switch Bandwidth for port 1"
units: "kilobits/s"
type: "area"
family: "ports"
dimensions:
- name: "in"
oid: "1.3.6.1.2.1.2.2.1.10.1"
algorithm: "incremental"
multiplier: 8
divisor: 1000
- name: "out"
oid: "1.3.6.1.2.1.2.2.1.16.1"
multiplier: -8
divisor: 1000
- id: "bandwidth_port2"
title: "Switch Bandwidth for port 2"
units: "kilobits/s"
type: "area"
family: "ports"
dimensions:
- name: "in"
oid: "1.3.6.1.2.1.2.2.1.10.2"
algorithm: "incremental"
multiplier: 8
divisor: 1000
- name: "out"
oid: "1.3.6.1.2.1.2.2.1.16.2"
multiplier: -8
divisor: 1000

Custom OIDs with multiply range

If you need to define many charts using incremental OIDs, you can use the charts.multiply_range option.

This is like the SNMPv1/2 example, but the option will multiply the current chart from 1 to 24 inclusive, producing 24 charts in total for the 24 ports of the switch 192.0.2.1.

Each of the 24 new charts will have its id (1-24) appended at:

  • its chart unique id, i.e. bandwidth_port_1 to bandwidth_port_24.
  • its title, i.e. Switch Bandwidth for port 1 to Switch Bandwidth for port 24.
  • its oid (for all dimensions), i.e. dimension in will be 1.3.6.1.2.1.2.2.1.10.1 to 1.3.6.1.2.1.2.2.1.10.24.
  • its priority will be incremented for each chart so that the charts will appear on the dashboard in this order.
Config
jobs:
- name: switch
update_every: 10
hostname: "192.0.2.1"
community: public
options:
version: 2
charts:
- id: "bandwidth_port"
title: "Switch Bandwidth for port"
units: "kilobits/s"
type: "area"
family: "ports"
multiply_range: [1, 24]
dimensions:
- name: "in"
oid: "1.3.6.1.2.1.2.2.1.10"
algorithm: "incremental"
multiplier: 8
divisor: 1000
- name: "out"
oid: "1.3.6.1.2.1.2.2.1.16"
multiplier: -8
divisor: 1000

Multiple devices with a common configuration

YAML supports anchors. The & defines and names an anchor, and the * uses it. <<: *anchor means, inject the anchor, then extend. We can use anchors to share the common configuration for multiple devices.

The following example:

  • adds an anchor to the first job.
  • injects (copies) the first job configuration to the second and updates name and hostname parameters.
  • injects (copies) the first job configuration to the third and updates name and hostname parameters.
Config
jobs:
- &anchor
name: switch
update_every: 10
hostname: "192.0.2.1"
community: public
options:
version: 2
charts:
- id: "bandwidth_port1"
title: "Switch Bandwidth for port 1"
units: "kilobits/s"
type: "area"
family: "ports"
dimensions:
- name: "in"
oid: "1.3.6.1.2.1.2.2.1.10.1"
algorithm: "incremental"
multiplier: 8
divisor: 1000
- name: "out"
oid: "1.3.6.1.2.1.2.2.1.16.1"
multiplier: -8
divisor: 1000
- <<: *anchor
name: switch2
hostname: "192.0.2.2"
- <<: *anchor
name: switch3
hostname: "192.0.2.3"

Troubleshooting

Debug Mode

To troubleshoot issues with the snmp collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    cd /usr/libexec/netdata/plugins.d/
  • Switch to the netdata user.

    sudo -u netdata -s
  • Run the go.d.plugin to debug the collector:

    ./go.d.plugin -d -m snmp

Getting Logs

If you're encountering problems with the snmp collector, follow these steps to retrieve logs and identify potential issues:

  • Run the command specific to your system (systemd, non-systemd, or Docker container).
  • Examine the output for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem.

System with systemd

Use the following command to view logs generated since the last Netdata service restart:

journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep snmp

System without systemd

Locate the collector log file, typically at /var/log/netdata/collector.log, and use grep to filter for collector's name:

grep snmp /var/log/netdata/collector.log

Note: This method shows logs from all restarts. Focus on the latest entries for troubleshooting current issues.

Docker Container

If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:

docker logs netdata 2>&1 | grep snmp

Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.