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