-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.go
59 lines (49 loc) · 1.38 KB
/
model.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
package main
import (
"time"
"golang.org/x/exp/slog"
)
type Config struct {
Global GlobalConfig `yaml:"global"`
Log LogConfig `yaml:"log"`
Server ServerConfig `yaml:"server"`
Configs []PlugConfig `yaml:"configs"`
}
type GlobalConfig struct {
ScrapeInterval time.Duration `yaml:"scrape_interval"`
ScrapeTimeout time.Duration `yaml:"scape_timeout"`
}
type LogConfig struct {
Level slog.Level `yaml:"level"`
Format string `yaml:"format"`
AddSource bool `yaml:"add_source"`
}
type ServerConfig struct {
ListenAddr string `yaml:"listen_addr"`
Endpoint string `yaml:"endpoint"`
}
type PlugConfig struct {
Name string `yaml:"name"`
Address string `yaml:"address"`
Insecure bool `yaml:"insecure"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Interval time.Duration `yaml:"interval"`
Timeout time.Duration `yaml:"timeout"`
}
type PlugStatus struct {
Meters []Meter `json:"meters"`
Temperature float64 `json:"temperature"`
Overtemperature bool `json:"overtemperature"`
Update Update `json:"update"`
Uptime int `json:"uptime"`
}
type Meter struct {
Power float64 `json:"power"`
IsValid bool `json:"is_valid"`
Overpower float64 `json:"overpower"`
Total int `json:"total"`
}
type Update struct {
HasUpdate bool `json:"has_update"`
}