Add Wavefront parser (#4402)

This commit is contained in:
Pierre Tessier
2018-08-13 19:37:06 -04:00
committed by Greg
parent b9ff1d042b
commit 6454319062
8 changed files with 808 additions and 13 deletions

View File

@@ -189,26 +189,32 @@ func buildTags(mTags map[string]string, w *Wavefront) (string, map[string]string
}
var source string
sourceTagFound := false
for _, s := range w.SourceOverride {
for k, v := range mTags {
if k == s {
source = v
mTags["telegraf_host"] = mTags["host"]
sourceTagFound = true
delete(mTags, k)
if s, ok := mTags["source"]; ok {
source = s
delete(mTags, "source")
} else {
sourceTagFound := false
for _, s := range w.SourceOverride {
for k, v := range mTags {
if k == s {
source = v
mTags["telegraf_host"] = mTags["host"]
sourceTagFound = true
delete(mTags, k)
break
}
}
if sourceTagFound {
break
}
}
if sourceTagFound {
break
if !sourceTagFound {
source = mTags["host"]
}
}
if !sourceTagFound {
source = mTags["host"]
}
delete(mTags, "host")
return tagValueReplacer.Replace(source), mTags