forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
35 lines (30 loc) · 929 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
package deadman
import (
"time"
"github.com/influxdata/influxdb/toml"
)
const (
// Default deadman's switch interval
DefaultInterval = toml.Duration(time.Second * 10)
// Default deadman's switch threshold
DefaultThreshold = float64(0)
// Default deadman's switch id
DefaultId = "{{ .Group }}:NODE_NAME for task '{{ .TaskName }}'"
// Default deadman's switch message
DefaultMessage = "{{ .ID }} is {{ if eq .Level \"OK\" }}alive{{ else }}dead{{ end }}: {{ index .Fields \"emitted\" | printf \"%0.3f\" }} points/INTERVAL."
)
type Config struct {
Interval toml.Duration `toml:"interval"`
Threshold float64 `toml:"threshold"`
Id string `toml:"id"`
Message string `toml:"message"`
Global bool `toml:"global"`
}
func NewConfig() Config {
return Config{
Interval: DefaultInterval,
Threshold: DefaultThreshold,
Id: DefaultId,
Message: DefaultMessage,
}
}