Load config from disk|url, create incidents
- Resolve incidents after the monitor is up - Example configuration - Updated readme
This commit is contained in:
25
main.go
25
main.go
@@ -7,24 +7,9 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
monitors := []*cachet.Monitor{
|
||||
/*&cachet.Monitor{
|
||||
Name: "nodegear frontend",
|
||||
Url: "https://nodegear.io/ping",
|
||||
MetricId: 1,
|
||||
Threshold: 80.0,
|
||||
ExpectedStatusCode: 200,
|
||||
},*/
|
||||
&cachet.Monitor{
|
||||
Name: "local test server",
|
||||
Url: "http://localhost:1337",
|
||||
Threshold: 80.0,
|
||||
ExpectedStatusCode: 200,
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("Starting %d monitors:\n", len(monitors))
|
||||
for _, monitor := range monitors {
|
||||
fmt.Printf("API: %s\n", cachet.Config.API_Url)
|
||||
fmt.Printf("Starting %d monitors:\n", len(cachet.Config.Monitors))
|
||||
for _, monitor := range cachet.Config.Monitors {
|
||||
fmt.Printf(" %s: GET %s & Expect HTTP %d\n", monitor.Name, monitor.Url, monitor.ExpectedStatusCode)
|
||||
if monitor.MetricId > 0 {
|
||||
fmt.Printf(" - Logs lag to metric id: %d\n", monitor.MetricId)
|
||||
@@ -35,8 +20,8 @@ func main() {
|
||||
|
||||
ticker := time.NewTicker(time.Second)
|
||||
for _ = range ticker.C {
|
||||
for _, monitor := range monitors {
|
||||
for _, monitor := range cachet.Config.Monitors {
|
||||
go monitor.Run()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user