snmp plugin: change host -> snmp_host

closes #1156
This commit is contained in:
Cameron Sparr 2016-05-10 13:27:18 -07:00
parent afdebbc3a2
commit 85dee02a3b
4 changed files with 55 additions and 47 deletions

View File

@ -48,7 +48,15 @@ based on _prefix_ in addition to globs. This means that a filter like
- disque: `host -> disque_host` - disque: `host -> disque_host`
- rethinkdb: `host -> rethinkdb_host` - rethinkdb: `host -> rethinkdb_host`
- **Breaking Change**: The `win_perf_counters` input has been changed to sanitize field names, replacing `/Sec` and `/sec` with `_persec`, as well as spaces with underscores. This is needed because Graphite doesn't like slashes and spaces, and was failing to accept metrics that had them. The `/[sS]ec` -> `_persec` is just to make things clearer and uniform. - **Breaking Change**: The `win_perf_counters` input has been changed to
sanitize field names, replacing `/Sec` and `/sec` with `_persec`, as well as
spaces with underscores. This is needed because Graphite doesn't like slashes
and spaces, and was failing to accept metrics that had them.
The `/[sS]ec` -> `_persec` is just to make things clearer and uniform.
- **Breaking Change**: snmp plugin. The `host` tag of the snmp plugin has been
changed to the `snmp_host` tag.
- The `disk` input plugin can now be configured with the `HOST_MOUNT_PREFIX` environment variable. - The `disk` input plugin can now be configured with the `HOST_MOUNT_PREFIX` environment variable.
This value is prepended to any mountpaths discovered before retrieving stats. This value is prepended to any mountpaths discovered before retrieving stats.
It is not included on the report path. This is necessary for reporting host disk stats when running from within a container. It is not included on the report path. This is necessary for reporting host disk stats when running from within a container.

View File

@ -638,8 +638,8 @@
# #
# ## If no servers are specified, then default to 127.0.0.1:1936 # ## If no servers are specified, then default to 127.0.0.1:1936
# servers = ["http://myhaproxy.com:1936", "http://anotherhaproxy.com:1936"] # servers = ["http://myhaproxy.com:1936", "http://anotherhaproxy.com:1936"]
# ## Or you can also use local socket(not work yet) # ## Or you can also use local socket
# ## servers = ["socket://run/haproxy/admin.sock"] # ## servers = ["socket:/run/haproxy/admin.sock"]
# # HTTP/HTTPS request given an address a method and a timeout # # HTTP/HTTPS request given an address a method and a timeout

View File

@ -792,7 +792,7 @@ func (h *Host) HandleResponse(
// Because the result oid is equal to inputs.snmp.get section // Because the result oid is equal to inputs.snmp.get section
field_name = oid.Name field_name = oid.Name
} }
tags["host"], _, _ = net.SplitHostPort(h.Address) tags["snmp_host"], _, _ = net.SplitHostPort(h.Address)
fields := make(map[string]interface{}) fields := make(map[string]interface{})
fields[string(field_name)] = variable.Value fields[string(field_name)] = variable.Value

View File

@ -102,8 +102,8 @@ func TestSNMPGet1(t *testing.T) {
"oid1": uint(543846), "oid1": uint(543846),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -140,8 +140,8 @@ func TestSNMPGet2(t *testing.T) {
"ifNumber": int(4), "ifNumber": int(4),
}, },
map[string]string{ map[string]string{
"instance": "0", "instance": "0",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -180,9 +180,9 @@ func TestSNMPGet3(t *testing.T) {
"ifSpeed": uint(10000000), "ifSpeed": uint(10000000),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "1", "instance": "1",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -222,9 +222,9 @@ func TestSNMPEasyGet4(t *testing.T) {
"ifSpeed": uint(10000000), "ifSpeed": uint(10000000),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "1", "instance": "1",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -234,8 +234,8 @@ func TestSNMPEasyGet4(t *testing.T) {
"ifNumber": int(4), "ifNumber": int(4),
}, },
map[string]string{ map[string]string{
"instance": "0", "instance": "0",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -275,9 +275,9 @@ func TestSNMPEasyGet5(t *testing.T) {
"ifSpeed": uint(10000000), "ifSpeed": uint(10000000),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "1", "instance": "1",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -287,8 +287,8 @@ func TestSNMPEasyGet5(t *testing.T) {
"ifNumber": int(4), "ifNumber": int(4),
}, },
map[string]string{ map[string]string{
"instance": "0", "instance": "0",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -320,8 +320,8 @@ func TestSNMPEasyGet6(t *testing.T) {
"ifNumber": int(4), "ifNumber": int(4),
}, },
map[string]string{ map[string]string{
"instance": "0", "instance": "0",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -360,9 +360,9 @@ func TestSNMPBulk1(t *testing.T) {
"ifOutOctets": uint(543846), "ifOutOctets": uint(543846),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "1", "instance": "1",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -372,9 +372,9 @@ func TestSNMPBulk1(t *testing.T) {
"ifOutOctets": uint(26475179), "ifOutOctets": uint(26475179),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "2", "instance": "2",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -384,9 +384,9 @@ func TestSNMPBulk1(t *testing.T) {
"ifOutOctets": uint(108963968), "ifOutOctets": uint(108963968),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "3", "instance": "3",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -396,9 +396,9 @@ func TestSNMPBulk1(t *testing.T) {
"ifOutOctets": uint(12991453), "ifOutOctets": uint(12991453),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "36", "instance": "36",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }
@ -438,9 +438,9 @@ func dTestSNMPBulk2(t *testing.T) {
"ifOutOctets": uint(543846), "ifOutOctets": uint(543846),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "1", "instance": "1",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -450,9 +450,9 @@ func dTestSNMPBulk2(t *testing.T) {
"ifOutOctets": uint(26475179), "ifOutOctets": uint(26475179),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "2", "instance": "2",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -462,9 +462,9 @@ func dTestSNMPBulk2(t *testing.T) {
"ifOutOctets": uint(108963968), "ifOutOctets": uint(108963968),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "3", "instance": "3",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
@ -474,9 +474,9 @@ func dTestSNMPBulk2(t *testing.T) {
"ifOutOctets": uint(12991453), "ifOutOctets": uint(12991453),
}, },
map[string]string{ map[string]string{
"unit": "octets", "unit": "octets",
"instance": "36", "instance": "36",
"host": testutil.GetLocalHost(), "snmp_host": testutil.GetLocalHost(),
}, },
) )
} }