Default SNMP parameter changes
max-repetitions = 10 is the default of net-snmp utils according to http://net-snmp.sourceforge.net/docs/man/snmpbulkwalk.html retries = 3 is the default of gosnmp: https://godoc.org/github.com/soniah/gosnmp#pkg-variables Could deal with some parts of the performance issues reported by #1665
This commit is contained in:
parent
055ef168ae
commit
e7e39df6a0
|
@ -23,6 +23,7 @@
|
||||||
- [#1791](https://github.com/influxdata/telegraf/pull/1791): Add Docker container state metrics to Docker input plugin output
|
- [#1791](https://github.com/influxdata/telegraf/pull/1791): Add Docker container state metrics to Docker input plugin output
|
||||||
- [#1755](https://github.com/influxdata/telegraf/issues/1755): Add support to SNMP for IP & MAC address conversion.
|
- [#1755](https://github.com/influxdata/telegraf/issues/1755): Add support to SNMP for IP & MAC address conversion.
|
||||||
- [#1729](https://github.com/influxdata/telegraf/issues/1729): Add support to SNMP for OID index suffixes.
|
- [#1729](https://github.com/influxdata/telegraf/issues/1729): Add support to SNMP for OID index suffixes.
|
||||||
|
- [#1813](https://github.com/influxdata/telegraf/pull/1813): Change default arguments for SNMP plugin.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
|
|
|
@ -20,25 +20,29 @@ import (
|
||||||
const description = `Retrieves SNMP values from remote agents`
|
const description = `Retrieves SNMP values from remote agents`
|
||||||
const sampleConfig = `
|
const sampleConfig = `
|
||||||
agents = [ "127.0.0.1:161" ]
|
agents = [ "127.0.0.1:161" ]
|
||||||
|
## Timeout for each SNMP query.
|
||||||
timeout = "5s"
|
timeout = "5s"
|
||||||
|
## Number of retries to attempt within timeout.
|
||||||
|
retries = 3
|
||||||
|
## SNMP version, values can be 1, 2, or 3
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
# SNMPv1 & SNMPv2 parameters
|
## SNMP community string.
|
||||||
community = "public"
|
community = "public"
|
||||||
|
|
||||||
# SNMPv2 & SNMPv3 parameters
|
## The GETBULK max-repetitions parameter
|
||||||
max_repetitions = 50
|
max_repetitions = 10
|
||||||
|
|
||||||
# SNMPv3 parameters
|
## SNMPv3 auth parameters
|
||||||
#sec_name = "myuser"
|
#sec_name = "myuser"
|
||||||
#auth_protocol = "md5" # Values: "MD5", "SHA", ""
|
#auth_protocol = "md5" # Values: "MD5", "SHA", ""
|
||||||
#auth_password = "password123"
|
#auth_password = "pass"
|
||||||
#sec_level = "authNoPriv" # Values: "noAuthNoPriv", "authNoPriv", "authPriv"
|
#sec_level = "authNoPriv" # Values: "noAuthNoPriv", "authNoPriv", "authPriv"
|
||||||
#context_name = ""
|
#context_name = ""
|
||||||
#priv_protocol = "" # Values: "DES", "AES", ""
|
#priv_protocol = "" # Values: "DES", "AES", ""
|
||||||
#priv_password = ""
|
#priv_password = ""
|
||||||
|
|
||||||
# measurement name
|
## measurement name
|
||||||
name = "system"
|
name = "system"
|
||||||
[[inputs.snmp.field]]
|
[[inputs.snmp.field]]
|
||||||
name = "hostname"
|
name = "hostname"
|
||||||
|
@ -53,7 +57,7 @@ const sampleConfig = `
|
||||||
oid = "HOST-RESOURCES-MIB::hrMemorySize"
|
oid = "HOST-RESOURCES-MIB::hrMemorySize"
|
||||||
|
|
||||||
[[inputs.snmp.table]]
|
[[inputs.snmp.table]]
|
||||||
# measurement name
|
## measurement name
|
||||||
name = "remote_servers"
|
name = "remote_servers"
|
||||||
inherit_tags = [ "hostname" ]
|
inherit_tags = [ "hostname" ]
|
||||||
[[inputs.snmp.table.field]]
|
[[inputs.snmp.table.field]]
|
||||||
|
@ -68,7 +72,7 @@ const sampleConfig = `
|
||||||
oid = ".1.0.0.0.1.2"
|
oid = ".1.0.0.0.1.2"
|
||||||
|
|
||||||
[[inputs.snmp.table]]
|
[[inputs.snmp.table]]
|
||||||
# auto populate table's fields using the MIB
|
## auto populate table's fields using the MIB
|
||||||
oid = "HOST-RESOURCES-MIB::hrNetworkTable"
|
oid = "HOST-RESOURCES-MIB::hrNetworkTable"
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -105,7 +109,7 @@ type Snmp struct {
|
||||||
Community string
|
Community string
|
||||||
|
|
||||||
// Parameters for Version 2 & 3
|
// Parameters for Version 2 & 3
|
||||||
MaxRepetitions uint
|
MaxRepetitions int
|
||||||
|
|
||||||
// Parameters for Version 3
|
// Parameters for Version 3
|
||||||
ContextName string
|
ContextName string
|
||||||
|
@ -340,8 +344,8 @@ func Errorf(err error, msg string, format ...interface{}) error {
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add("snmp", func() telegraf.Input {
|
inputs.Add("snmp", func() telegraf.Input {
|
||||||
return &Snmp{
|
return &Snmp{
|
||||||
Retries: 5,
|
Retries: 3,
|
||||||
MaxRepetitions: 50,
|
MaxRepetitions: 10,
|
||||||
Timeout: internal.Duration{Duration: 5 * time.Second},
|
Timeout: internal.Duration{Duration: 5 * time.Second},
|
||||||
Version: 2,
|
Version: 2,
|
||||||
Community: "public",
|
Community: "public",
|
||||||
|
@ -638,7 +642,7 @@ func (s *Snmp) getConnection(agent string) (snmpConnection, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.MaxRepetitions = int(s.MaxRepetitions)
|
gs.MaxRepetitions = s.MaxRepetitions
|
||||||
|
|
||||||
if s.Version == 3 {
|
if s.Version == 3 {
|
||||||
gs.ContextName = s.ContextName
|
gs.ContextName = s.ContextName
|
||||||
|
|
|
@ -91,7 +91,8 @@ func TestSampleConfig(t *testing.T) {
|
||||||
Timeout: internal.Duration{Duration: 5 * time.Second},
|
Timeout: internal.Duration{Duration: 5 * time.Second},
|
||||||
Version: 2,
|
Version: 2,
|
||||||
Community: "public",
|
Community: "public",
|
||||||
MaxRepetitions: 50,
|
MaxRepetitions: 10,
|
||||||
|
Retries: 3,
|
||||||
|
|
||||||
Name: "system",
|
Name: "system",
|
||||||
Fields: []Field{
|
Fields: []Field{
|
||||||
|
@ -147,7 +148,6 @@ func TestFieldInit(t *testing.T) {
|
||||||
}
|
}
|
||||||
assert.Equal(t, txl.expectedOid, f.Oid, "inputOid='%s' inputName='%s' inputConversion='%s'", txl.inputOid, txl.inputName, txl.inputConversion)
|
assert.Equal(t, txl.expectedOid, f.Oid, "inputOid='%s' inputName='%s' inputConversion='%s'", txl.inputOid, txl.inputName, txl.inputConversion)
|
||||||
assert.Equal(t, txl.expectedName, f.Name, "inputOid='%s' inputName='%s' inputConversion='%s'", txl.inputOid, txl.inputName, txl.inputConversion)
|
assert.Equal(t, txl.expectedName, f.Name, "inputOid='%s' inputName='%s' inputConversion='%s'", txl.inputOid, txl.inputName, txl.inputConversion)
|
||||||
assert.Equal(t, txl.expectedConversion, f.Conversion, "inputOid='%s' inputName='%s' inputConversion='%s'", txl.inputOid, txl.inputName, txl.inputConversion)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue