github.com/netdata/go.d.plugin@v0.58.1/modules/snmp/integrations/snmp_devices.md (about)

     1  <!--startmeta
     2  custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/snmp/README.md"
     3  meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/snmp/metadata.yaml"
     4  sidebar_label: "SNMP devices"
     5  learn_status: "Published"
     6  learn_rel_path: "Data Collection/Generic Data Collection"
     7  most_popular: True
     8  message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
     9  endmeta-->
    10  
    11  # SNMP devices
    12  
    13  
    14  <img src="https://netdata.cloud/img/snmp.png" width="150"/>
    15  
    16  
    17  Plugin: go.d.plugin
    18  Module: snmp
    19  
    20  <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
    21  
    22  ## Overview
    23  
    24  This collector monitors any SNMP devices and uses the [gosnmp](https://github.com/gosnmp/gosnmp) package.
    25  
    26  It supports:
    27  
    28  - all SNMP versions: SNMPv1, SNMPv2c and SNMPv3.
    29  - any number of SNMP devices.
    30  - each SNMP device can be used to collect data for any number of charts.
    31  - each chart may have any number of dimensions.
    32  - each SNMP device may have a different update frequency.
    33  - each SNMP device will accept one or more batches to report values (you can set `max_request_size` per SNMP server, to control the size of batches).
    34  
    35  Keep in mind that many SNMP switches and routers are very slow. They may not be able to report values per second.
    36  `go.d.plugin` reports the time it took for the SNMP device to respond when executed in the debug mode.
    37  
    38  Also, if many SNMP clients are used on the same SNMP device at the same time, values may be skipped.
    39  This is a problem of the SNMP device, not this collector. In this case, consider reducing the frequency of data collection (increasing `update_every`).
    40  
    41  
    42  
    43  
    44  This collector is supported on all platforms.
    45  
    46  This collector supports collecting metrics from multiple instances of this integration, including remote instances.
    47  
    48  
    49  ### Default Behavior
    50  
    51  #### Auto-Detection
    52  
    53  This integration doesn't support auto-detection.
    54  
    55  #### Limits
    56  
    57  The default configuration for this integration does not impose any limits on data collection.
    58  
    59  #### Performance Impact
    60  
    61  The default configuration for this integration is not expected to impose a significant performance impact on the system.
    62  
    63  
    64  ## Metrics
    65  
    66  The metrics that will be collected are defined in the configuration file.
    67  
    68  
    69  ## Alerts
    70  
    71  There are no alerts configured by default for this integration.
    72  
    73  
    74  ## Setup
    75  
    76  ### Prerequisites
    77  
    78  #### Find OIDs
    79  
    80  Use `snmpwalk`, like this:
    81  
    82  ```sh
    83  snmpwalk -t 20 -O fn -v 2c -c public 192.0.2.1
    84  ```
    85  
    86  - `-t 20` is the timeout in seconds.
    87  - `-O fn` will display full OIDs in numeric format.
    88  - `-v 2c` is the SNMP version.
    89  - `-c public` is the SNMP community.
    90  - `192.0.2.1` is the SNMP device.
    91  
    92  
    93  
    94  ### Configuration
    95  
    96  #### File
    97  
    98  The configuration file name for this integration is `go.d/snmp.conf`.
    99  
   100  
   101  You can edit the configuration file using the `edit-config` script from the
   102  Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory).
   103  
   104  ```bash
   105  cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
   106  sudo ./edit-config go.d/snmp.conf
   107  ```
   108  #### Options
   109  
   110  The following options can be defined globally: update_every, autodetection_retry.
   111  
   112  
   113  <details><summary>Config options</summary>
   114  
   115  | Name | Description | Default | Required |
   116  |:----|:-----------|:-------|:--------:|
   117  | update_every | Data collection frequency. | 1 | no |
   118  | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no |
   119  | hostname | Target ipv4 address. | 127.0.0.1 | yes |
   120  | community | SNMPv1/2 community string. | public | no |
   121  | options.version | SNMP version. Available versions: 1, 2, 3. | 2 | no |
   122  | options.port | Target port. | 161 | no |
   123  | options.retries | Retries to attempt. | 1 | no |
   124  | options.timeout | SNMP request/response timeout. | 10 | no |
   125  | options.max_request_size | Maximum number of OIDs allowed in one one SNMP request. | 60 | no |
   126  | user.name | SNMPv3 user name. |  | no |
   127  | user.name | Security level of SNMPv3 messages. |  | no |
   128  | user.auth_proto | Security level of SNMPv3 messages. |  | no |
   129  | user.name | Authentication protocol for SNMPv3 messages. |  | no |
   130  | user.auth_key | Authentication protocol pass phrase. |  | no |
   131  | user.priv_proto | Privacy protocol for SNMPv3 messages. |  | no |
   132  | user.priv_key | Privacy protocol pass phrase. |  | no |
   133  | charts | List of charts. | [] | yes |
   134  | charts.id | Chart ID. Used to uniquely identify the chart. |  | yes |
   135  | charts.title | Chart title. | Untitled chart | no |
   136  | charts.units | Chart units. | num | no |
   137  | charts.family | Chart family. | charts.id | no |
   138  | charts.type | Chart type (line, area, stacked). | line | no |
   139  | charts.priority | Chart priority. | 70000 | no |
   140  | charts.multiply_range | Used when you need to define many charts using incremental OIDs. | [] | no |
   141  | charts.dimensions | List of chart dimensions. | [] | yes |
   142  | charts.dimensions.oid | Collected metric OID. |  | yes |
   143  | charts.dimensions.name | Dimension name. |  | yes |
   144  | charts.dimensions.algorithm | Dimension algorithm (absolute, incremental). | absolute | no |
   145  | charts.dimensions.multiplier | Collected value multiplier, applied to convert it properly to units. | 1 | no |
   146  | charts.dimensions.divisor | Collected value divisor, applied to convert it properly to units. | 1 | no |
   147  
   148  ##### user.auth_proto
   149  
   150  The security of an SNMPv3 message as per RFC 3414 (`user.level`):
   151  
   152  | String value | Int value | Description                              |
   153  |:------------:|:---------:|------------------------------------------|
   154  |     none     |     1     | no message authentication or encryption  |
   155  |  authNoPriv  |     2     | message authentication and no encryption |
   156  |   authPriv   |     3     | message authentication and encryption    |
   157  
   158  
   159  ##### user.name
   160  
   161  The digest algorithm for SNMPv3 messages that require authentication (`user.auth_proto`):
   162  
   163  | String value | Int value | Description                               |
   164  |:------------:|:---------:|-------------------------------------------|
   165  |     none     |     1     | no message authentication                 |
   166  |     md5      |     2     | MD5 message authentication (HMAC-MD5-96)  |
   167  |     sha      |     3     | SHA message authentication (HMAC-SHA-96)  |
   168  |    sha224    |     4     | SHA message authentication (HMAC-SHA-224) |
   169  |    sha256    |     5     | SHA message authentication (HMAC-SHA-256) |
   170  |    sha384    |     6     | SHA message authentication (HMAC-SHA-384) |
   171  |    sha512    |     7     | SHA message authentication (HMAC-SHA-512) |
   172  
   173  
   174  ##### user.priv_proto
   175  
   176  The encryption algorithm for SNMPv3 messages that require privacy (`user.priv_proto`):
   177  
   178  | String value | Int value | Description                                                             |
   179  |:------------:|:---------:|-------------------------------------------------------------------------|
   180  |     none     |     1     | no message encryption                                                   |
   181  |     des      |     2     | ES encryption (CBC-DES)                                                 |
   182  |     aes      |     3     | 128-bit AES encryption (CFB-AES-128)                                    |
   183  |    aes192    |     4     | 192-bit AES encryption (CFB-AES-192) with "Blumenthal" key localization |
   184  |    aes256    |     5     | 256-bit AES encryption (CFB-AES-256) with "Blumenthal" key localization |
   185  |   aes192c    |     6     | 192-bit AES encryption (CFB-AES-192) with "Reeder" key localization     |
   186  |   aes256c    |     7     | 256-bit AES encryption (CFB-AES-256) with "Reeder" key localization     |
   187  
   188  
   189  </details>
   190  
   191  #### Examples
   192  
   193  ##### SNMPv1/2
   194  
   195  In this example:
   196  
   197  - the SNMP device is `192.0.2.1`.
   198  - the SNMP version is `2`.
   199  - the SNMP community is `public`.
   200  - we will update the values every 10 seconds.
   201  - we define 2 charts `bandwidth_port1` and `bandwidth_port2`, each having 2 dimensions: `in` and `out`.
   202  
   203  > **SNMPv1**: just set `options.version` to 1.
   204  > **Note**: the algorithm chosen is `incremental`, because the collected values show the total number of bytes transferred, which we need to transform into kbps. To chart gauges (e.g. temperature), use `absolute` instead.
   205  
   206  
   207  <details><summary>Config</summary>
   208  
   209  ```yaml
   210  jobs:
   211    - name: switch
   212      update_every: 10
   213      hostname: 192.0.2.1
   214      community: public
   215      options:
   216        version: 2
   217      charts:
   218        - id: "bandwidth_port1"
   219          title: "Switch Bandwidth for port 1"
   220          units: "kilobits/s"
   221          type: "area"
   222          family: "ports"
   223          dimensions:
   224            - name: "in"
   225              oid: "1.3.6.1.2.1.2.2.1.10.1"
   226              algorithm: "incremental"
   227              multiplier: 8
   228              divisor: 1000
   229            - name: "out"
   230              oid: "1.3.6.1.2.1.2.2.1.16.1"
   231              multiplier: -8
   232              divisor: 1000
   233        - id: "bandwidth_port2"
   234          title: "Switch Bandwidth for port 2"
   235          units: "kilobits/s"
   236          type: "area"
   237          family: "ports"
   238          dimensions:
   239            - name: "in"
   240              oid: "1.3.6.1.2.1.2.2.1.10.2"
   241              algorithm: "incremental"
   242              multiplier: 8
   243              divisor: 1000
   244            - name: "out"
   245              oid: "1.3.6.1.2.1.2.2.1.16.2"
   246              multiplier: -8
   247              divisor: 1000
   248  
   249  ```
   250  </details>
   251  
   252  ##### SNMPv3
   253  
   254  To use SNMPv3:
   255  
   256  - use `user` instead of `community`.
   257  - set `options.version` to 3.
   258  
   259  The rest of the configuration is the same as in the SNMPv1/2 example.
   260  
   261  
   262  <details><summary>Config</summary>
   263  
   264  ```yaml
   265  jobs:
   266    - name: switch
   267      update_every: 10
   268      hostname: 192.0.2.1
   269      options:
   270        version: 3
   271      user:
   272        name: username
   273        level: authPriv
   274        auth_proto: sha256
   275        auth_key: auth_protocol_passphrase
   276        priv_proto: aes256
   277        priv_key: priv_protocol_passphrase
   278  
   279  ```
   280  </details>
   281  
   282  ##### Multiply range
   283  
   284  If you need to define many charts using incremental OIDs, you can use the `charts.multiply_range` option.
   285  
   286  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`.
   287  
   288  Each of the 24 new charts will have its id (1-24) appended at:
   289  
   290  - its chart unique `id`, i.e. `bandwidth_port_1` to `bandwidth_port_24`.
   291  - its title, i.e. `Switch Bandwidth for port 1` to `Switch Bandwidth for port 24`.
   292  - 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`.
   293  - its `priority` will be incremented for each chart so that the charts will appear on the dashboard in this order.
   294  
   295  
   296  <details><summary>Config</summary>
   297  
   298  ```yaml
   299  jobs:
   300    - name: switch
   301      update_every: 10
   302      hostname: "192.0.2.1"
   303      community: public
   304      options:
   305        version: 2
   306      charts:
   307        - id: "bandwidth_port"
   308          title: "Switch Bandwidth for port"
   309          units: "kilobits/s"
   310          type: "area"
   311          family: "ports"
   312          multiply_range: [1, 24]
   313          dimensions:
   314            - name: "in"
   315              oid: "1.3.6.1.2.1.2.2.1.10"
   316              algorithm: "incremental"
   317              multiplier: 8
   318              divisor: 1000
   319            - name: "out"
   320              oid: "1.3.6.1.2.1.2.2.1.16"
   321              multiplier: -8
   322              divisor: 1000
   323  
   324  ```
   325  </details>
   326  
   327  ##### Multiple devices with a common configuration
   328  
   329  YAML supports [anchors](https://yaml.org/spec/1.2.2/#3222-anchors-and-aliases). 
   330  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.
   331  
   332  The following example:
   333  
   334  - adds an `anchor` to the first job.
   335  - injects (copies) the first job configuration to the second and updates `name` and `hostname` parameters.
   336  - injects (copies) the first job configuration to the third and updates `name` and `hostname` parameters.
   337  
   338  
   339  <details><summary>Config</summary>
   340  
   341  ```yaml
   342  jobs:
   343    - &anchor
   344      name: switch
   345      update_every: 10
   346      hostname: "192.0.2.1"
   347      community: public
   348      options:
   349        version: 2
   350      charts:
   351        - id: "bandwidth_port1"
   352          title: "Switch Bandwidth for port 1"
   353          units: "kilobits/s"
   354          type: "area"
   355          family: "ports"
   356          dimensions:
   357            - name: "in"
   358              oid: "1.3.6.1.2.1.2.2.1.10.1"
   359              algorithm: "incremental"
   360              multiplier: 8
   361              divisor: 1000
   362            - name: "out"
   363              oid: "1.3.6.1.2.1.2.2.1.16.1"
   364              multiplier: -8
   365              divisor: 1000
   366    - <<: *anchor
   367      name: switch2
   368      hostname: "192.0.2.2"
   369    - <<: *anchor
   370      name: switch3
   371      hostname: "192.0.2.3"
   372  
   373  ```
   374  </details>
   375  
   376  
   377  
   378  ## Troubleshooting
   379  
   380  ### Debug Mode
   381  
   382  To troubleshoot issues with the `snmp` collector, run the `go.d.plugin` with the debug option enabled. The output
   383  should give you clues as to why the collector isn't working.
   384  
   385  - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
   386    your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
   387  
   388    ```bash
   389    cd /usr/libexec/netdata/plugins.d/
   390    ```
   391  
   392  - Switch to the `netdata` user.
   393  
   394    ```bash
   395    sudo -u netdata -s
   396    ```
   397  
   398  - Run the `go.d.plugin` to debug the collector:
   399  
   400    ```bash
   401    ./go.d.plugin -d -m snmp
   402    ```
   403  
   404