Add time interval
This commit is contained in:
4
main.go
4
main.go
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user