From 9ecc82bf0f657779869de5ec71cbb2b54c9fa5be Mon Sep 17 00:00:00 2001 From: InfiniteCode Date: Tue, 16 Aug 2016 13:42:18 -0700 Subject: [PATCH] Update jolokia.go Some of the values returned from jolokia have three levels of nesting. This fixes the issue of maps being returned instead of values. --- plugins/inputs/jolokia/jolokia.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/jolokia/jolokia.go b/plugins/inputs/jolokia/jolokia.go index 53bb65fd0..2ae65f32a 100644 --- a/plugins/inputs/jolokia/jolokia.go +++ b/plugins/inputs/jolokia/jolokia.go @@ -252,7 +252,14 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error { switch t2 := v.(type) { case map[string]interface{}: for k2, v2 := range t2 { - fields[measurement+"_"+k+"_"+k2] = v2 + switch t3 := v2.(type) { + case map[string]interface{}: + for k3, v3 := range t3 { + fields[measurement+"_"+k+"_"+k2+"_"+k3] = v3 + } + case interface{}: + fields[measurement+"_"+k+"_"+k2] = v2 + } } case interface{}: fields[measurement+"_"+k] = t2