Prevent startup if intervals are 0

This commit is contained in:
Daniel Nelson 2017-07-17 11:58:47 -07:00
parent 6edd848e4c
commit 99e5ccee6f
1 changed files with 10 additions and 0 deletions

View File

@ -153,6 +153,16 @@ func reloadLoop(
log.Fatalf("E! Error: no inputs found, did you provide a valid config file?")
}
if int64(c.Agent.Interval.Duration) <= 0 {
log.Fatalf("E! Agent interval must be positive, found %s",
c.Agent.Interval.Duration)
}
if int64(c.Agent.FlushInterval.Duration) <= 0 {
log.Fatalf("E! Agent flush_interval must be positive; found %s",
c.Agent.Interval.Duration)
}
ag, err := agent.NewAgent(c)
if err != nil {
log.Fatal("E! " + err.Error())