2016-07-28 14:55:03 +00:00
# SNMP Plugin
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
The SNMP input plugin gathers metrics from SNMP agents.
It is an alternative to the SNMP plugin with significantly different configuration & behavior.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
## Configuration:
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
### Example:
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
SNMP data:
2016-03-02 00:45:40 +00:00
```
2016-07-28 14:55:03 +00:00
.1.2.3.0.0.1.0 octet_str "foo"
.1.2.3.0.0.1.1 octet_str "bar"
.1.2.3.0.0.102 octet_str "bad"
.1.2.3.0.0.2.0 integer 1
.1.2.3.0.0.2.1 integer 2
.1.2.3.0.0.3.0 octet_str "0.123"
.1.2.3.0.0.3.1 octet_str "0.456"
.1.2.3.0.0.3.2 octet_str "9.999"
.1.2.3.0.1 octet_str "baz"
.1.2.3.0.2 uinteger 54321
.1.2.3.0.3 uinteger 234
2016-03-02 00:45:40 +00:00
```
2016-07-28 14:55:03 +00:00
Telegraf config:
2016-03-02 00:45:40 +00:00
```toml
[[inputs.snmp]]
2016-07-28 14:55:03 +00:00
agents = [ "127.0.0.1:161" ]
version = 2
community = "public"
name = "system"
[[inputs.snmp.field]]
name = "hostname"
oid = ".1.2.3.0.1"
is_tag = true
[[inputs.snmp.field]]
name = "uptime"
oid = ".1.2.3.0.2"
[[inputs.snmp.field]]
name = "loadavg"
oid = ".1.2.3.0.3"
conversion = "float(2)"
2016-03-02 00:45:40 +00:00
[[inputs.snmp.table]]
2016-07-28 14:55:03 +00:00
name = "remote_servers"
inherit_tags = [ "hostname" ]
[[inputs.snmp.table.field]]
name = "server"
oid = ".1.2.3.0.0.1"
is_tag = true
[[inputs.snmp.table.field]]
name = "connections"
oid = ".1.2.3.0.0.2"
[[inputs.snmp.table.field]]
name = "latency"
oid = ".1.2.3.0.0.3"
conversion = "float"
2016-03-02 00:45:40 +00:00
```
2016-07-28 14:55:03 +00:00
Resulting output:
2016-03-02 00:45:40 +00:00
```
2016-07-28 14:55:03 +00:00
* Plugin: snmp, Collection 1
> system,agent_host=127.0.0.1,host=mylocalhost,hostname=baz loadavg=2.34,uptime=54321i 1468953135000000000
> remote_servers,agent_host=127.0.0.1,host=mylocalhost,hostname=baz,server=foo connections=1i,latency=0.123 1468953135000000000
> remote_servers,agent_host=127.0.0.1,host=mylocalhost,hostname=baz,server=bar connections=2i,latency=0.456 1468953135000000000
2016-03-02 00:45:40 +00:00
```
2016-07-28 14:55:03 +00:00
### Config parameters
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `agents` : Default: `[]`
List of SNMP agents to connect to in the form of `IP[:PORT]` . If `:PORT` is unspecified, it defaults to `161` .
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `version` : Default: `2`
SNMP protocol version to use.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `community` : Default: `"public"`
SNMP community to use.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `max_repetitions` : Default: `50`
Maximum number of iterations for repeating variables.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `sec_name` :
Security name for authenticated SNMPv3 requests.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `auth_protocol` : Values: `"MD5"` ,`"SHA"`,`""`. Default: `""`
Authentication protocol for authenticated SNMPv3 requests.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `auth_password` :
Authentication password for authenticated SNMPv3 requests.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `sec_level` : Values: `"noAuthNoPriv"` ,`"authNoPriv"`,`"authPriv"`. Default: `"noAuthNoPriv"`
Security level used for SNMPv3 messages.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `context_name` :
Context name used for SNMPv3 requests.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `priv_protocol` : Values: `"DES"` ,`"AES"`,`""`. Default: `""`
Privacy protocol used for encrypted SNMPv3 messages.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `priv_password` :
Privacy password used for encrypted SNMPv3 messages.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `name` :
Output measurement name.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
#### Field parameters:
* `name` :
Output field/tag name.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `oid` :
OID to get. Must be in dotted notation, not textual.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `is_tag` :
Output this field as a tag.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `conversion` : Values: `"float(X)"` ,`"float"`,`"int"`,`""`. Default: `""`
Converts the value according to the given specification.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
- `float(X)` : Converts the input value into a float and divides by the Xth power of 10. Efficively just moves the decimal left X places. For example a value of `123` with `float(2)` will result in `1.23` .
- `float` : Converts the value into a float with no adjustment. Same as `float(0)` .
- `int` : Convertes the value into an integer.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
#### Table parameters:
* `name` :
Output measurement name.
2016-03-02 00:45:40 +00:00
2016-07-28 14:55:03 +00:00
* `inherit_tags` :
Which tags to inherit from the top-level config and to use in the output of this table's measurement.