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.
This commit is contained in:
InfiniteCode 2016-08-16 13:42:18 -07:00 committed by GitHub
parent 7600757f16
commit 9ecc82bf0f
1 changed files with 8 additions and 1 deletions

View File

@ -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