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:
parent
7600757f16
commit
9ecc82bf0f
|
@ -252,8 +252,15 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
|
||||||
switch t2 := v.(type) {
|
switch t2 := v.(type) {
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
for k2, v2 := range t2 {
|
for k2, v2 := range t2 {
|
||||||
|
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
|
fields[measurement+"_"+k+"_"+k2] = v2
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case interface{}:
|
case interface{}:
|
||||||
fields[measurement+"_"+k] = t2
|
fields[measurement+"_"+k] = t2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue