54 lines
925 B
Go
54 lines
925 B
Go
// Copyright 2024 WIT.COM Inc Licensed GPL 3.0
|
|
|
|
package main
|
|
|
|
import (
|
|
"embed"
|
|
"os"
|
|
"time"
|
|
|
|
"go.wit.com/dev/alexflint/arg"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
var Version string
|
|
|
|
//go:embed resources/*
|
|
var resources embed.FS
|
|
|
|
func main() {
|
|
pp := arg.MustParse(&argv)
|
|
|
|
if !argv.Uptime {
|
|
pp.WriteHelp(os.Stdout)
|
|
os.Exit(0)
|
|
}
|
|
|
|
log.Info("connect to cluser here", argv.Hosts)
|
|
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()
|
|
}
|
|
}
|
|
|
|
}
|