-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
67 lines (57 loc) · 1.48 KB
/
Copy pathmain.go
File metadata and controls
67 lines (57 loc) · 1.48 KB
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
58
59
60
61
62
63
64
65
66
67
package main
import (
"flag"
"fmt"
"os"
"strings"
)
var (
flagCluster = flag.String("c", "", "Cluster to connect to, e.g. v5, c2")
flagDeploy = flag.String("deploy", "", "Module to deploy, e.g. larskluge/string-upcase")
flagVersion = flag.String("version", "v0", "Module Version to deploy, e.g. v17")
flagMemory = flag.Int("mem", 16, "Memory allowance")
flagTimeout = flag.String("timeout", "30s", "Timeout for Command")
flagMonitor = flag.String("monitor", "", "cluster stats (lag)")
flagTopic = flag.String("t", "", "topic to inspect")
Cluster string
ClusterAddr string
Broker string
BurrowEndpoint string
)
func main() {
flag.Parse()
Cluster = *flagCluster
if Cluster == "" {
fmt.Println("Please specify which cluster to connect to, e.g. -c v5")
os.Exit(1)
}
ClusterAddr = Cluster + ".babl.sh"
Broker = ClusterAddr + ":9092"
BurrowEndpoint = "http://" + ClusterAddr + ":8000/v2/kafka"
if *flagDeploy != "" {
Deploy(*flagDeploy, *flagVersion, *flagMemory, *flagTimeout)
return
}
if *flagMonitor == "lag" {
l := Lag{interval: 1}
if status, msg := l.ping(); status == true {
clusters := l.getCluster()
for _, c := range clusters {
l.start(c)
}
} else {
fmt.Println("Sorry Cant do!", msg)
}
return
} else if *flagMonitor == "module" {
ParseModule()
} else if *flagMonitor == "events" {
ParseEvents()
}
if *flagTopic != "" {
topic := *flagTopic
ParseTopic(strings.Split(topic, ","))
} else {
ParseRaw()
}
}