Fixed the bug and modified the config testing data for exec plugin

This commit is contained in:
Henry Hu 2016-02-03 23:00:56 +08:00
parent 3d9eeb0d8e
commit 7c8222813b
2 changed files with 3 additions and 3 deletions

View File

@ -107,7 +107,7 @@
# Read flattened metrics from one or more commands that output JSON to stdout # Read flattened metrics from one or more commands that output JSON to stdout
[[inputs.exec]] [[inputs.exec]]
# the command to run # the command to run
command = "/usr/bin/mycollector --foo=bar" commands = ["/usr/bin/mycollector --foo=bar"]
name_suffix = "_mycollector" name_suffix = "_mycollector"
# Read metrics of haproxy, via socket or csv stats page # Read metrics of haproxy, via socket or csv stats page

View File

@ -89,7 +89,7 @@ func (t *Tail) Start() error {
c := NewConfig(t.Files, t.Separator, t.Tags, t.Templates) c := NewConfig(t.Files, t.Separator, t.Tags, t.Templates)
c.WithDefaults() c.WithDefaults()
if err := c.Validate(); err != nil { 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 t.config = c
@ -111,7 +111,7 @@ func (t *Tail) Start() error {
for i, fileName := range t.Files { for i, fileName := range t.Files {
t.tailPointers[i], err = t.tailFile(fileName) t.tailPointers[i], err = t.tailFile(fileName)
if err != nil { 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 { } else {
t.logger.Printf("Openning the file: %s to tail", fileName) t.logger.Printf("Openning the file: %s to tail", fileName)
} }