From 99e5ccee6fde361f21fccb89e8bb3eb202ff2c3e Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Mon, 17 Jul 2017 11:58:47 -0700 Subject: [PATCH] Prevent startup if intervals are 0 --- cmd/telegraf/telegraf.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index e341606df..07cffe569 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -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())