-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
48 lines (39 loc) · 912 Bytes
/
main.go
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
package main
import (
"flag"
"fmt"
"github.com/BurntSushi/toml"
"github.com/fullcontact/crankshaftd/crankshaft"
"os"
"strings"
)
var (
VERSION = "0.1.0-alpha"
configFile = flag.String("config", "config.toml", "Configuration file")
config crankshaft.Config
)
func usage() {
fmt.Fprintln(os.Stderr, "usage: crankshaft [opts]")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
flag.Usage = usage
flag.Parse()
if _, err := toml.DecodeFile("config.toml", &config); err != nil {
fmt.Println(err)
return
}
if len(config.Host) == 0 {
fmt.Fprintln(os.Stderr, "Error: Must specify a turbine host")
usage()
}
if len(config.Clusters) == 0 {
fmt.Fprintln(os.Stderr, "Error: Must specify at least one cluster")
usage()
}
fmt.Println(strings.Repeat("#", 80))
fmt.Println("Crankshaft ", VERSION)
fmt.Println(strings.Repeat("#", 80) + "\n")
crankshaft.MonitorClusters(config)
}