-
Notifications
You must be signed in to change notification settings - Fork 8
/
config.go
40 lines (35 loc) · 867 Bytes
/
config.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
package falconmetrics
import (
"os"
"os/exec"
"strings"
)
//FalconConfig config of open-falcon
type FalconConfig struct {
Debug bool `json:""`
EndPoint string `json:"endpoint"`
HostName string `json:"hostname"` //hostname of agent default is http://127.0.0.1:1988/v1/push
Step int64 `json:"interval"` // interval to report metrics (s)
BaseTags string `json:"basetags"` // base tags
}
//DefaultFalconConfig default config
var DefaultFalconConfig = FalconConfig{
HostName: "http://127.0.0.1:1988/v1/push",
Step: 60,
EndPoint: defaultHostname(),
}
func defaultProjectName() string {
s, _ := exec.LookPath(os.Args[0])
psName := ""
if strings.Contains(s, "/") {
ss := strings.Split(s, "/")
psName = ss[len(ss)-1]
} else {
psName = s
}
return psName
}
func defaultHostname() string {
hostname, _ := os.Hostname()
return hostname
}