jolokia: handle multiple multi-dimensional attributes (#1524)

fixes #1481
This commit is contained in:
Torsten Rehn 2016-07-20 15:47:04 +02:00 committed by Cameron Sparr
parent 191608041f
commit 0af0fa7c2e
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@
- [#1519](https://github.com/influxdata/telegraf/pull/1519): Fix error race conditions and partial failures.
- [#1477](https://github.com/influxdata/telegraf/issues/1477): nstat: fix inaccurate config panic.
- [#1481](https://github.com/influxdata/telegraf/issues/1481): jolokia: fix handling multiple multi-dimensional attributes.
## v1.0 beta 3 [2016-07-18]

View File

@ -249,7 +249,14 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
switch t := values.(type) {
case map[string]interface{}:
for k, v := range t {
fields[measurement+"_"+k] = v
switch t2 := v.(type) {
case map[string]interface{}:
for k2, v2 := range t2 {
fields[measurement+"_"+k+"_"+k2] = v2
}
case interface{}:
fields[measurement+"_"+k] = t2
}
}
case interface{}:
fields[measurement] = t