-
Notifications
You must be signed in to change notification settings - Fork 13
/
structs.go
69 lines (56 loc) · 1.6 KB
/
structs.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
package proxmox
import (
"encoding/json"
"net/http"
"net/url"
"github.com/circonus-labs/circonus-unified-agent/cua"
"github.com/circonus-labs/circonus-unified-agent/internal"
"github.com/circonus-labs/circonus-unified-agent/plugins/common/tls"
)
type Proxmox struct {
BaseURL string `toml:"base_url"`
APIToken string `toml:"api_token"`
ResponseTimeout internal.Duration `toml:"response_timeout"`
NodeName string `toml:"node_name"`
tls.ClientConfig
httpClient *http.Client
nodeSearchDomain string
requestFunction func(px *Proxmox, apiUrl string, method string, data url.Values) ([]byte, error)
Log cua.Logger `toml:"-"`
}
type VMCurrentStats struct {
Data VMStat `json:"data"`
}
type ResourceType string
var (
QEMU ResourceType = "qemu"
LXC ResourceType = "lxc"
)
type VMStats struct {
Data []VMStat `json:"data"`
}
type VMStat struct {
ID string `json:"vmid"`
Name string `json:"name"`
Status string `json:"status"`
UsedMem json.Number `json:"mem"`
TotalMem json.Number `json:"maxmem"`
UsedDisk json.Number `json:"disk"`
TotalDisk json.Number `json:"maxdisk"`
UsedSwap json.Number `json:"swap"`
TotalSwap json.Number `json:"maxswap"`
Uptime json.Number `json:"uptime"`
CPULoad json.Number `json:"cpu"`
}
type VMConfig struct {
Data struct {
Searchdomain string `json:"searchdomain"`
Hostname string `json:"hostname"`
Template string `json:"template"`
} `json:"data"`
}
type NodeDNS struct {
Data struct {
Searchdomain string `json:"search"`
} `json:"data"`
}