2024-10-11 13:55:13 -05:00
|
|
|
// Copyright 2024 WIT.COM Inc Licensed GPL 3.0
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-10-12 00:17:26 -05:00
|
|
|
"embed"
|
2024-10-11 13:55:13 -05:00
|
|
|
"os"
|
2024-10-12 10:59:11 -05:00
|
|
|
"time"
|
2024-10-11 13:55:13 -05:00
|
|
|
|
|
|
|
"go.wit.com/dev/alexflint/arg"
|
2024-10-12 00:17:26 -05:00
|
|
|
"go.wit.com/log"
|
2024-10-11 13:55:13 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
var Version string
|
2024-10-12 00:17:26 -05:00
|
|
|
|
|
|
|
//go:embed resources/*
|
|
|
|
var resources embed.FS
|
2024-10-11 13:55:13 -05:00
|
|
|
|
|
|
|
func main() {
|
2024-10-12 00:17:26 -05:00
|
|
|
pp := arg.MustParse(&argv)
|
2024-10-11 13:55:13 -05:00
|
|
|
|
2024-10-12 10:59:11 -05:00
|
|
|
if !argv.Uptime {
|
2024-10-11 13:55:13 -05:00
|
|
|
pp.WriteHelp(os.Stdout)
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
|
2024-10-12 00:17:26 -05:00
|
|
|
log.Info("connect to cluser here", argv.Hosts)
|
2024-10-12 10:59:11 -05:00
|
|
|
for _, s := range argv.Hosts {
|
|
|
|
me.names = append(me.names, s)
|
|
|
|
|
|
|
|
log.Info("Make a hypervisor struct for", s)
|
|
|
|
var h HyperT
|
|
|
|
h.Hostname = s
|
|
|
|
h.Autoscan = true
|
|
|
|
h.Delay = 3 * time.Second
|
|
|
|
h.Scan = func() {
|
|
|
|
log.Info("scanned farm03?")
|
|
|
|
h.pollHypervisor()
|
|
|
|
}
|
|
|
|
me.hypers = append(me.hypers, h)
|
|
|
|
}
|
|
|
|
go startHTTP()
|
|
|
|
|
|
|
|
log.Info("me.names =", me.names)
|
|
|
|
for _, h := range me.hypers {
|
|
|
|
log.Info("me hostname =", h.Hostname)
|
|
|
|
if h.Hostname == "farm03" {
|
|
|
|
log.Info("should start watchdog here for hostname =", h.Hostname)
|
|
|
|
h.NewWatchdog()
|
|
|
|
}
|
2024-10-12 00:17:26 -05:00
|
|
|
}
|
|
|
|
|
2024-10-11 13:55:13 -05:00
|
|
|
}
|