Skip to content

Commit

Permalink
Revert "refactor: snmp to use gosmi (influxdata#9518)"
Browse files Browse the repository at this point in the history
This reverts commit 7675ce6.
  • Loading branch information
nward committed Jan 12, 2022
1 parent 4dc2d92 commit f8a7529
Show file tree
Hide file tree
Showing 25 changed files with 808 additions and 7,574 deletions.
2 changes: 0 additions & 2 deletions internal/snmp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ type ClientConfig struct {
Retries int `toml:"retries"`
// Values: 1, 2, 3
Version uint8 `toml:"version"`
// Path to mib files
Path []string `toml:"path"`

// Parameters for Version 1 & 2
Community string `toml:"community"`
Expand Down
188 changes: 0 additions & 188 deletions internal/snmp/translate.go

This file was deleted.

24 changes: 16 additions & 8 deletions plugins/inputs/snmp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ The `snmp` input plugin uses polling to gather metrics from SNMP agents.
Support for gathering individual OIDs as well as complete SNMP tables is
included.

## Note about Paths
## Prerequisites

Path is a global variable, separate snmp instances will append the specified
path onto the global path variable
This plugin uses the `snmptable` and `snmptranslate` programs from the
[net-snmp][] project. These tools will need to be installed into the `PATH` in
order to be located. Other utilities from the net-snmp project may be useful
for troubleshooting, but are not directly used by the plugin.

These programs will load available MIBs on the system. Typically the default
directory for MIBs is `/usr/share/snmp/mibs`, but if your MIBs are in a
different location you may need to make the paths known to net-snmp. The
location of these files can be configured in the `snmp.conf` or via the
`MIBDIRS` environment variable. See [`man 1 snmpcmd`][man snmpcmd] for more
information.

## Configuration

Expand All @@ -29,9 +38,6 @@ path onto the global path variable
## SNMP version; can be 1, 2, or 3.
# version = 2

## Path to mib files
# path = ["/usr/share/snmp/mibs"]

## SNMP community string.
# community = "public"

Expand Down Expand Up @@ -254,7 +260,7 @@ oid = "CISCO-POWER-ETHERNET-EXT-MIB::cpeExtPsePortEntPhyIndex"

Partial result (removed agent_host and host columns from all following outputs in this section):

```text
```shell
> ciscoPower,index=1.2 EntPhyIndex=1002i,PortPwrConsumption=6643i 1621460628000000000
> ciscoPower,index=1.6 EntPhyIndex=1006i,PortPwrConsumption=10287i 1621460628000000000
> ciscoPower,index=1.5 EntPhyIndex=1005i,PortPwrConsumption=8358i 1621460628000000000
Expand Down Expand Up @@ -307,7 +313,7 @@ is_tag = true

Result:

```text
```shell
> ciscoPowerEntity,EntPhysicalName=GigabitEthernet1/2,index=1.2 EntPhyIndex=1002i,PortPwrConsumption=6643i 1621461148000000000
> ciscoPowerEntity,EntPhysicalName=GigabitEthernet1/6,index=1.6 EntPhyIndex=1006i,PortPwrConsumption=10287i 1621461148000000000
> ciscoPowerEntity,EntPhysicalName=GigabitEthernet1/5,index=1.5 EntPhyIndex=1005i,PortPwrConsumption=8358i 1621461148000000000
Expand Down Expand Up @@ -351,5 +357,7 @@ interface,agent_host=127.0.0.1,ifDescr=eth0,ifIndex=2,source=example.org ifAdmin
interface,agent_host=127.0.0.1,ifDescr=lo,ifIndex=1,source=example.org ifAdminStatus=1i,ifInDiscards=0i,ifInErrors=0i,ifInNUcastPkts=0i,ifInOctets=51555569i,ifInUcastPkts=339097i,ifInUnknownProtos=0i,ifLastChange=0i,ifMtu=65536i,ifOperStatus=1i,ifOutDiscards=0i,ifOutErrors=0i,ifOutNUcastPkts=0i,ifOutOctets=51555569i,ifOutQLen=0i,ifOutUcastPkts=339097i,ifSpecific=".0.0",ifSpeed=10000000i,ifType=24i 1575509815000000000
```

[net-snmp]: http://www.net-snmp.org/
[man snmpcmd]: http://net-snmp.sourceforge.net/docs/man/snmpcmd.html#lbAK
[metric filtering]: /docs/CONFIGURATION.md#metric-filtering
[metric]: /docs/METRICS.md
Loading

0 comments on commit f8a7529

Please sign in to comment.