-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (52 loc) · 1.21 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
ui "github.com/gizak/termui"
"github.com/agirot/superviGo/rabbitmq"
"github.com/agirot/superviGo/config"
"github.com/agirot/superviGo/sentry"
"github.com/agirot/superviGo/redis"
"github.com/agirot/superviGo/http_status"
)
func main() {
config.HydrateConfiguration()
if err := ui.Init(); err != nil {
panic(err)
}
defer ui.Close()
//Redis supervision
redisWindow := redis.Render()
//RabbitMQ supervision
rabbitWindow := rabbitmq.Render()
//Sentry supervision
sentryWindow := sentry.Render()
//Http status
httpWindow := httpStatus.Render()
// build layout
ui.Body.AddRows(
ui.NewRow(
ui.NewCol(6, 0, sentryWindow),
ui.NewCol(6, 0, rabbitWindow, redisWindow, httpWindow),
),
)
// calculate layout
ui.Body.Align()
ui.Render(ui.Body)
//Event list
ui.Handle("/sys/kbd/q", func(ui.Event) {
ui.StopLoop()
})
ui.Handle("/timer/1s", func(e ui.Event) {
rabbitmq.UpdateRender(rabbitWindow)
sentry.UpdateRender(sentryWindow)
redis.UpdateRender(redisWindow)
httpStatus.UpdateRender(httpWindow)
ui.Render(ui.Body)
})
ui.Handle("/sys/wnd/resize", func(e ui.Event) {
ui.Body.Width = ui.TermWidth()
ui.Body.Align()
ui.Clear()
ui.Render(ui.Body)
})
ui.Loop()
}