parent
58ff2a2412
commit
ba61b78631
1
argv.go
1
argv.go
|
@ -14,6 +14,7 @@ type args struct {
|
|||
Hosts []string `arg:"--hosts" help:"hosts to connect to"`
|
||||
Uptime bool `arg:"--uptime" default:"true" help:"allow uptime checks for things like Kuma"`
|
||||
Port int `arg:"--port" default:"8080" help:"specify a different default port"`
|
||||
Daemon bool `arg:"--daemon" help:"run in daemon mode"`
|
||||
}
|
||||
|
||||
func (a args) Description() string {
|
||||
|
|
4
main.go
4
main.go
|
@ -24,6 +24,10 @@ func main() {
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
if argv.Daemon {
|
||||
log.DaemonMode(true)
|
||||
}
|
||||
|
||||
readConfigFile("droplets")
|
||||
|
||||
log.Info("create cluser for", argv.Hosts)
|
||||
|
|
7
poll.go
7
poll.go
|
@ -36,8 +36,11 @@ func (h HyperT) pollHypervisor() {
|
|||
d.lastpoll = time.Now()
|
||||
d.CurrentState = "ON"
|
||||
// log.Info("ALREADY RECORDED", d.Hostname, d.lastpoll)
|
||||
if d.hname == "" {
|
||||
log.Log(EVENT, "DROPLET", d.Hostname, "PROBABLY WAS NEVER POLLED YET")
|
||||
}
|
||||
if d.hname != h.Hostname {
|
||||
log.Log(EVENT, "DROPLET", d.Hostname, "MOVED FROM", d.hname, "TO", d.Hostname)
|
||||
log.Log(EVENT, "DROPLET", d.Hostname, "MOVED FROM", d.hname, "TO", h.Hostname)
|
||||
d.hname = h.Hostname
|
||||
}
|
||||
continue
|
||||
|
@ -72,7 +75,7 @@ func clusterHealthy() bool {
|
|||
}
|
||||
dur := time.Since(d.lastpoll) // Calculate the elapsed time
|
||||
if d.CurrentState != "ON" {
|
||||
log.Info("BAD STATE ", d.Hostname, "State =", d.State, "CurrentState =", d.CurrentState, shell.FormatDuration(dur))
|
||||
log.Info("BAD STATE", d.State, d.Hostname, d.hname, "CurrentState =", d.CurrentState, shell.FormatDuration(dur))
|
||||
good = false
|
||||
} else {
|
||||
dur := time.Since(d.lastpoll) // Calculate the elapsed time
|
||||
|
|
Loading…
Reference in New Issue