forked from open-falcon/falcon-plus
/
g.go
125 lines (112 loc) · 3.08 KB
/
g.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package g
import "path/filepath"
var Modules map[string]bool
var BinOf map[string]string
var cfgOf map[string]string
var ModuleApps map[string]string
var logpathOf map[string]string
var PidOf map[string]string
var AllModulesInOrder []string
func init() {
Modules = map[string]bool{
"agent": true,
"aggregator": true,
"graph": true,
"hbs": true,
"judge": true,
"nodata": true,
"transfer": true,
"gateway": true,
"api": true,
"alarm": true,
}
BinOf = map[string]string{
"agent": "./agent/bin/falcon-agent",
"aggregator": "./aggregator/bin/falcon-aggregator",
"graph": "./graph/bin/falcon-graph",
"hbs": "./hbs/bin/falcon-hbs",
"judge": "./judge/bin/falcon-judge",
"nodata": "./nodata/bin/falcon-nodata",
"transfer": "./transfer/bin/falcon-transfer",
"gateway": "./gateway/bin/falcon-gateway",
"api": "./api/bin/falcon-api",
"alarm": "./alarm/bin/falcon-alarm",
}
cfgOf = map[string]string{
"agent": "./agent/config/cfg.json",
"aggregator": "./aggregator/config/cfg.json",
"graph": "./graph/config/cfg.json",
"hbs": "./hbs/config/cfg.json",
"judge": "./judge/config/cfg.json",
"nodata": "./nodata/config/cfg.json",
"transfer": "./transfer/config/cfg.json",
"gateway": "./gateway/config/cfg.json",
"api": "./api/config/cfg.json",
"alarm": "./alarm/config/cfg.json",
}
ModuleApps = map[string]string{
"agent": "falcon-agent",
"aggregator": "falcon-aggregator",
"graph": "falcon-graph",
"hbs": "falcon-hbs",
"judge": "falcon-judge",
"nodata": "falcon-nodata",
"transfer": "falcon-transfer",
"gateway": "falcon-gateway",
"api": "falcon-api",
"alarm": "falcon-alarm",
}
logpathOf = map[string]string{
"agent": "./agent/logs/agent.log",
"aggregator": "./aggregator/logs/aggregator.log",
"graph": "./graph/logs/graph.log",
"hbs": "./hbs/logs/hbs.log",
"judge": "./judge/logs/judge.log",
"nodata": "./nodata/logs/nodata.log",
"transfer": "./transfer/logs/transfer.log",
"gateway": "./gateway/logs/gateway.log",
"api": "./api/logs/api.log",
"alarm": "./alarm/logs/alarm.log",
}
PidOf = map[string]string{
"agent": "<NOT SET>",
"aggregator": "<NOT SET>",
"graph": "<NOT SET>",
"hbs": "<NOT SET>",
"judge": "<NOT SET>",
"nodata": "<NOT SET>",
"transfer": "<NOT SET>",
"gateway": "<NOT SET>",
"api": "<NOT SET>",
"alarm": "<NOT SET>",
}
// Modules are deployed in this order
AllModulesInOrder = []string{
"graph",
"hbs",
"judge",
"transfer",
"nodata",
"aggregator",
"agent",
"gateway",
"api",
"alarm",
}
}
func Bin(name string) string {
p, _ := filepath.Abs(BinOf[name])
return p
}
func Cfg(name string) string {
p, _ := filepath.Abs(cfgOf[name])
return p
}
func LogPath(name string) string {
p, _ := filepath.Abs(logpathOf[name])
return p
}
func LogDir(name string) string {
d, _ := filepath.Abs(filepath.Dir(logpathOf[name]))
return d
}