add missing import and Tag marshalling

This commit is contained in:
JP 2015-08-12 15:17:50 -05:00
parent ed13924c5a
commit ddf438dac0
2 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"strings"
"github.com/influxdb/telegraf"
_ "github.com/influxdb/telegraf/outputs/all"
_ "github.com/influxdb/telegraf/plugins/all"
)
@ -63,6 +64,10 @@ func main() {
if err != nil {
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)
if err != nil {
@ -111,6 +116,7 @@ func main() {
log.Printf("Agent Config: Interval:%s, Debug:%#v, Hostname:%#v\n",
ag.Interval, ag.Debug, ag.Hostname)
}
log.Printf("Tags enabled: %v", config.ListTags)
if *fPidfile != "" {
f, err := os.Create(*fPidfile)

View File

@ -273,6 +273,7 @@ func LoadConfig(path string) (*Config, error) {
}
c := &Config{
Tags: make(map[string]string),
plugins: make(map[string]*ast.Table),
outputs: make(map[string]*ast.Table),
}
@ -286,6 +287,10 @@ func LoadConfig(path string) (*Config, error) {
switch name {
case "agent":
c.agent = subtbl
case "tags":
if err := toml.UnmarshalTable(subtbl, c.Tags); err != nil {
return nil, errInvalidConfig
}
case "outputs":
for outputName, outputVal := range subtbl.Fields {
outputSubtbl, ok := outputVal.(*ast.Table)