Prevent startup if intervals are 0

This commit is contained in:
Daniel Nelson 2017-07-17 11:58:47 -07:00
parent dbe2f79019
commit d8f7b76253
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
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?") 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) ag, err := agent.NewAgent(c)
if err != nil { if err != nil {
log.Fatal("E! " + err.Error()) log.Fatal("E! " + err.Error())