add missing import and Tag marshalling
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/influxdb/telegraf"
|
"github.com/influxdb/telegraf"
|
||||||
|
_ "github.com/influxdb/telegraf/outputs/all"
|
||||||
_ "github.com/influxdb/telegraf/plugins/all"
|
_ "github.com/influxdb/telegraf/plugins/all"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -63,6 +64,10 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if len(outputs) == 0 {
|
||||||
|
log.Printf("Error: no ouputs found, did you provide a config file?")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
plugins, err := ag.LoadPlugins(*fPLuginsFilter)
|
plugins, err := ag.LoadPlugins(*fPLuginsFilter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -111,6 +116,7 @@ func main() {
|
|||||||
log.Printf("Agent Config: Interval:%s, Debug:%#v, Hostname:%#v\n",
|
log.Printf("Agent Config: Interval:%s, Debug:%#v, Hostname:%#v\n",
|
||||||
ag.Interval, ag.Debug, ag.Hostname)
|
ag.Interval, ag.Debug, ag.Hostname)
|
||||||
}
|
}
|
||||||
|
log.Printf("Tags enabled: %v", config.ListTags)
|
||||||
|
|
||||||
if *fPidfile != "" {
|
if *fPidfile != "" {
|
||||||
f, err := os.Create(*fPidfile)
|
f, err := os.Create(*fPidfile)
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ func LoadConfig(path string) (*Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c := &Config{
|
c := &Config{
|
||||||
|
Tags: make(map[string]string),
|
||||||
plugins: make(map[string]*ast.Table),
|
plugins: make(map[string]*ast.Table),
|
||||||
outputs: make(map[string]*ast.Table),
|
outputs: make(map[string]*ast.Table),
|
||||||
}
|
}
|
||||||
@@ -286,6 +287,10 @@ func LoadConfig(path string) (*Config, error) {
|
|||||||
switch name {
|
switch name {
|
||||||
case "agent":
|
case "agent":
|
||||||
c.agent = subtbl
|
c.agent = subtbl
|
||||||
|
case "tags":
|
||||||
|
if err := toml.UnmarshalTable(subtbl, c.Tags); err != nil {
|
||||||
|
return nil, errInvalidConfig
|
||||||
|
}
|
||||||
case "outputs":
|
case "outputs":
|
||||||
for outputName, outputVal := range subtbl.Fields {
|
for outputName, outputVal := range subtbl.Fields {
|
||||||
outputSubtbl, ok := outputVal.(*ast.Table)
|
outputSubtbl, ok := outputVal.(*ast.Table)
|
||||||
|
|||||||
Reference in New Issue
Block a user