virtigo/main.go

53 lines
870 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)
}
readConfigFile("droplets")
log.Info("create cluser for", argv.Hosts)
for _, s := range argv.Hosts {
me.names = append(me.names, s)
log.Info("Making a hypervisor struct for", s)
var h HyperT
h.Hostname = s
h.Autoscan = true
h.Delay = 5 * time.Second
h.Scan = func() {
h.pollHypervisor()
}
me.hypers = append(me.hypers, h)
}
// start the watchdog polling for each hypervisor
for _, h := range me.hypers {
log.Info("starting watchdog here for hostname =", h.Hostname)
go h.NewWatchdog()
}
// sit here
startHTTP()
}