jolokia: add 'server_' prefix to tags

it avoid overwriting the telegraf-wide host tag
This commit is contained in:
Simone Aiello 2016-04-18 22:50:58 +02:00
parent 5e9980f263
commit cd3202f402
3 changed files with 7 additions and 7 deletions

View File

@ -54,4 +54,4 @@ are collected for each server configured.
See: https://jolokia.org/
# Measurements:
Jolokia plugin produces one measure for each metric configured, adding Server's `name`, `host` and `port` as tags.
Jolokia plugin produces one measure for each metric configured, adding Server's `server_name`, `server_host` and `server_port` as tags.

View File

@ -222,9 +222,9 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
tags := make(map[string]string)
for _, server := range servers {
tags["server"] = server.Name
tags["port"] = server.Port
tags["host"] = server.Host
tags["server_name"] = server.Name
tags["server_port"] = server.Port
tags["server_host"] = server.Host
fields := make(map[string]interface{})
for _, metric := range metrics {

View File

@ -96,9 +96,9 @@ func TestHttpJsonMultiValue(t *testing.T) {
"heap_memory_usage_used": 203288528.0,
}
tags := map[string]string{
"host": "127.0.0.1",
"port": "8080",
"server": "as1",
"server_host": "127.0.0.1",
"server_port": "8080",
"server_name": "as1",
}
acc.AssertContainsTaggedFields(t, "jolokia", fields, tags)
}