From cd3202f40220519eb1a8445abfb7187b537b68de Mon Sep 17 00:00:00 2001 From: Simone Aiello Date: Mon, 18 Apr 2016 22:50:58 +0200 Subject: [PATCH] jolokia: add 'server_' prefix to tags it avoid overwriting the telegraf-wide host tag --- plugins/inputs/jolokia/README.md | 2 +- plugins/inputs/jolokia/jolokia.go | 6 +++--- plugins/inputs/jolokia/jolokia_test.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/inputs/jolokia/README.md b/plugins/inputs/jolokia/README.md index cec3c95ce..05ade3d01 100644 --- a/plugins/inputs/jolokia/README.md +++ b/plugins/inputs/jolokia/README.md @@ -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. diff --git a/plugins/inputs/jolokia/jolokia.go b/plugins/inputs/jolokia/jolokia.go index cd536ede2..b692310d4 100644 --- a/plugins/inputs/jolokia/jolokia.go +++ b/plugins/inputs/jolokia/jolokia.go @@ -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 { diff --git a/plugins/inputs/jolokia/jolokia_test.go b/plugins/inputs/jolokia/jolokia_test.go index 67befc3f8..ff0c0e49d 100644 --- a/plugins/inputs/jolokia/jolokia_test.go +++ b/plugins/inputs/jolokia/jolokia_test.go @@ -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) }