Added Tags as toml field
This commit is contained in:
parent
25fd4297a8
commit
2daa9ff260
|
@ -32,7 +32,7 @@ type Jolokia struct {
|
||||||
Context string
|
Context string
|
||||||
Servers []Server
|
Servers []Server
|
||||||
Metrics []Metric
|
Metrics []Metric
|
||||||
|
Tags map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@ func (j *Jolokia) SampleConfig() string {
|
||||||
return `[jolokia]
|
return `[jolokia]
|
||||||
context = "/jolokia/read"
|
context = "/jolokia/read"
|
||||||
|
|
||||||
|
[[jolokia.tags]]
|
||||||
|
group = "as"
|
||||||
|
|
||||||
[[jolokia.servers]]
|
[[jolokia.servers]]
|
||||||
name = "stable"
|
name = "stable"
|
||||||
host = "192.168.103.2"
|
host = "192.168.103.2"
|
||||||
|
@ -147,11 +150,13 @@ func (j *Jolokia) Gather(acc plugins.Accumulator) error {
|
||||||
context := j.Context //"/jolokia/read"
|
context := j.Context //"/jolokia/read"
|
||||||
servers := j.Servers
|
servers := j.Servers
|
||||||
metrics := j.Metrics
|
metrics := j.Metrics
|
||||||
|
tags := j.Tags
|
||||||
|
|
||||||
var tags = map[string]string{
|
if tags == nil{
|
||||||
"group": "application_server",
|
tags = map[string]string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for _, server := range servers {
|
for _, server := range servers {
|
||||||
for _, metric := range metrics {
|
for _, metric := range metrics {
|
||||||
|
|
||||||
|
@ -174,7 +179,7 @@ func (j *Jolokia) Gather(acc plugins.Accumulator) error {
|
||||||
acc.Add(measurement, values.(interface{}), tags)
|
acc.Add(measurement, values.(interface{}), tags)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fmt.Println("Missing key value")
|
fmt.Printf("Missing key 'value' in '%s' output response\n", url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue