Load config from disk|url, create incidents

- Resolve incidents after the monitor is up
- Example configuration
- Updated readme
This commit is contained in:
Matej Kramny
2015-03-18 22:58:45 +01:00
parent 44a9cf905f
commit 42237e9c86
9 changed files with 130 additions and 49 deletions

25
main.go
View File

@@ -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()
}
}
}
}