From 7c8222813b44ce21e1f4b8a74734572e250d8641 Mon Sep 17 00:00:00 2001 From: Henry Hu Date: Wed, 3 Feb 2016 23:00:56 +0800 Subject: [PATCH] Fixed the bug and modified the config testing data for exec plugin --- internal/config/testdata/telegraf-agent.toml | 2 +- plugins/inputs/tail/tail.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/config/testdata/telegraf-agent.toml b/internal/config/testdata/telegraf-agent.toml index 5ede47016..8bde486dd 100644 --- a/internal/config/testdata/telegraf-agent.toml +++ b/internal/config/testdata/telegraf-agent.toml @@ -107,7 +107,7 @@ # Read flattened metrics from one or more commands that output JSON to stdout [[inputs.exec]] # the command to run - command = "/usr/bin/mycollector --foo=bar" + commands = ["/usr/bin/mycollector --foo=bar"] name_suffix = "_mycollector" # Read metrics of haproxy, via socket or csv stats page diff --git a/plugins/inputs/tail/tail.go b/plugins/inputs/tail/tail.go index f9a539724..265f9a75e 100644 --- a/plugins/inputs/tail/tail.go +++ b/plugins/inputs/tail/tail.go @@ -89,7 +89,7 @@ func (t *Tail) Start() error { c := NewConfig(t.Files, t.Separator, t.Tags, t.Templates) c.WithDefaults() if err := c.Validate(); err != nil { - return fmt.Errorf("Tail input configuration is error! ", err.Error()) + return fmt.Errorf("Tail input configuration is error: %s ", err.Error()) } t.config = c @@ -111,7 +111,7 @@ func (t *Tail) Start() error { for i, fileName := range t.Files { t.tailPointers[i], err = t.tailFile(fileName) if err != nil { - fmt.Errorf("Can not open the file: %s to tail", fileName) + return fmt.Errorf("Can not open the file: %s to tail", fileName) } else { t.logger.Printf("Openning the file: %s to tail", fileName) }