scout - Simple checking of http, tcp, udp, connections and icmp checks
- Ability to monitor multiple services
- Ability to monitor tcp, udp, http, and icmp
- Ability to add and remove services for monitoring
- Ability to specify expected response content and codes
- Ability to specify check interval and timeouts per service
$ go get github.com/phenixrizen/scout
package main
import (
"io/ioutil"
"time"
"github.com/ghodss/yaml"
"github.com/sirupsen/logrus"
"github.com/phenixrizen/scout"
)
[]
func main() {
log := logrus.New()
var servs []*scout.Service
yb, err := ioutil.ReadFile("./services.yml")
if err != nil {
logrus.Fatal(err)
}
err = yaml.Unmarshal(yb, &servs)
if err != nil {
logrus.Fatal(err)
}
s := scout.NewScout(servs, log)
go s.StartScoutingServices()
go s.HandleResponses()
for {
time.Sleep(30 * time.Second)
for _, serv := range s.Services {
log.Infof("Service: %s, Address: %s, Type: %s, Online: %t, Last Online: %s, Last Status Code: %d, Latency: %.6fs, Ping Time: %.6fs", serv.Name, serv.Address, serv.Type, serv.Online, serv.LastOnline, serv.LastStatusCode, serv.Latency, serv.PingTime)
}
}
}
---
- id: 8b3c6416-2578-4418-8cbf-a8424e7ce04d
name: Google
address: https://google.com
expected: ''
expectedStatus: 200
checkInterval: 5s
type: http
timeout: 5s
- id: 409455e9-c496-4907-8478-34cff2e7b131
name: Netlify
address: https://netlify.com
expected: ''
expectedStatus: 200
checkInterval: 3.2s
type: http
timeout: 5s
- id: fe727692-bde3-4021-819b-1ceedad4aa27
name: Netlify
address: netlify.com
checkInterval: 1.5s
type: icmp
timeout: 150ms
- id: 18f8bcce-ce1e-4f45-b209-c284593b5b94
name: HP
address: hp.com
checkInterval: 1.5s
type: icmp
retry: true
retryMinInterval: 1s
retryMaxInterval: 10s
retryMax: 10
timeout: 150ms
trace: true