Detects hostname/interface ip

- Hostname is monitor's id. Incidents will be created with the monitor id.
This commit is contained in:
Matej Kramny
2015-03-21 11:44:52 +01:00
parent bdb426c232
commit dce1978b51
4 changed files with 50 additions and 12 deletions

18
main.go
View File

@@ -7,12 +7,14 @@ import (
)
func main() {
fmt.Printf("API: %s\n", cachet.Config.APIUrl)
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)
config := cachet.Config
fmt.Printf("System: %s, API: %s\n", config.SystemName, config.APIUrl)
fmt.Printf("Starting %d monitors:\n", len(config.Monitors))
for _, mon := range config.Monitors {
fmt.Printf(" %s: GET %s & Expect HTTP %d\n", mon.Name, mon.URL, mon.ExpectedStatusCode)
if mon.MetricID > 0 {
fmt.Printf(" - Logs lag to metric id: %d\n", mon.MetricID)
}
}
@@ -20,8 +22,8 @@ func main() {
ticker := time.NewTicker(time.Second)
for range ticker.C {
for _, monitor := range cachet.Config.Monitors {
go monitor.Run()
for _, mon := range config.Monitors {
go mon.Run()
}
}
}