blob: f7e14a637761186401b58b0252d10d1286612318 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// 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)
}
if argv.Daemon {
log.DaemonMode(true)
}
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)
h := new(HyperT)
h.Hostname = s
h.Autoscan = true
h.Delay = 5 * time.Second
h.lastpoll = time.Now()
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()
}
|