Add time interval

This commit is contained in:
Mathieu Doyon
2015-04-08 14:28:36 -04:00
parent 350244514a
commit f918ea38cd
4 changed files with 7 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ func main() {
config := cachet.Config
log := cachet.Logger
log.Printf("System: %s, API: %s\n", config.SystemName, config.APIUrl)
log.Printf("System: %s, Interval: %d second(s), API: %s\n", config.SystemName, config.Interval, config.APIUrl)
log.Printf("Starting %d monitors:\n", len(config.Monitors))
for _, mon := range config.Monitors {
log.Printf(" %s: GET %s & Expect HTTP %d\n", mon.Name, mon.URL, mon.ExpectedStatusCode)
@@ -20,7 +20,7 @@ func main() {
log.Println()
ticker := time.NewTicker(time.Second)
ticker := time.NewTicker(time.Duration(config.Interval)*time.Second)
for range ticker.C {
for _, mon := range config.Monitors {
go mon.Run()