Added Tags as toml field

This commit is contained in:
saiello 2015-10-28 11:36:03 +01:00 committed by Cameron Sparr
parent 25fd4297a8
commit 2daa9ff260
1 changed files with 10 additions and 5 deletions

View File

@ -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,10 +150,12 @@ 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
if tags == nil{
tags = map[string]string{}
}
var tags = map[string]string{
"group": "application_server",
}
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)
} }
} }
} }