/
collections.go
47 lines (40 loc) · 1.48 KB
/
collections.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
package mongo
const (
KDBMonitor = "monitor"
KCollMonitorData = "monitor_data"
KCollUserLog = "user_log"
)
type MonitorData struct {
Id string `json:"id" bson:"_id"`
AgentName string `json:"agent_name" bson:"agent_name"`
System string `json:"system" bson:"system"`
Network *NetworkInfo `json:"network" bson:"network"`
Cpu *CpuInfo `json:"cpu" bson:"cpu"`
Mem *MemInfo `json:"mem" bson:"mem"`
Disk *DiskInfo `json:"disk" bson:"disk"`
Time int64 `json:"time" bson:"time"`
}
type NetworkInfo struct {
Ips []string `json:"ips" bson:"ips"`
Ios int `json:"ios" bson:"ios"`
}
type CpuInfo struct {
Models []string `json:"models" bson:"models"`
LogicCoreNum int `json:"logic_core_num" bson:"logic_core_num"`
PhysicalCoreNum int `json:"physical_core_num" bson:"physical_core_num"`
Usage float64 `json:"usage" bson:"usage"`
}
type MemInfo struct {
Total uint64 `json:"total" bson:"total"`
Actual uint64 `json:"actual" bson:"actual"`
Swap uint64 `json:"swap" bson:"swap"`
}
type DiskInfo struct {
Total uint64 `json:"total" bson:"total"`
Used uint64 `json:"used" bson:"used"`
}
type UserLog struct {
UserId string `json:"user_id" bson:"user_id"`
Time int64 `json:"time" bson:"time"`
QueryParams interface{} `json:"query_params" bson:"query_params"`
}