mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
优化监控上传
This commit is contained in:
@@ -11,11 +11,8 @@ const (
|
||||
// State ..
|
||||
type State struct {
|
||||
CPU float64
|
||||
MemTotal uint64
|
||||
MemUsed uint64
|
||||
SwapTotal uint64
|
||||
SwapUsed uint64
|
||||
DiskTotal uint64
|
||||
DiskUsed uint64
|
||||
NetInTransfer uint64
|
||||
NetOutTransfer uint64
|
||||
@@ -28,11 +25,8 @@ type State struct {
|
||||
func (s *State) PB() *pb.State {
|
||||
return &pb.State{
|
||||
Cpu: s.CPU,
|
||||
MemTotal: s.MemTotal,
|
||||
MemUsed: s.MemUsed,
|
||||
SwapTotal: s.SwapTotal,
|
||||
SwapUsed: s.SwapUsed,
|
||||
DiskTotal: s.DiskTotal,
|
||||
DiskUsed: s.DiskUsed,
|
||||
NetInTransfer: s.NetInTransfer,
|
||||
NetOutTransfer: s.NetOutTransfer,
|
||||
@@ -46,11 +40,8 @@ func (s *State) PB() *pb.State {
|
||||
func PB2State(s *pb.State) State {
|
||||
return State{
|
||||
CPU: s.GetCpu(),
|
||||
MemTotal: s.GetMemTotal(),
|
||||
MemUsed: s.GetMemUsed(),
|
||||
SwapTotal: s.GetSwapTotal(),
|
||||
SwapUsed: s.GetSwapUsed(),
|
||||
DiskTotal: s.GetDiskTotal(),
|
||||
DiskUsed: s.GetDiskUsed(),
|
||||
NetInTransfer: s.GetNetInTransfer(),
|
||||
NetOutTransfer: s.GetNetOutTransfer(),
|
||||
@@ -65,6 +56,9 @@ type Host struct {
|
||||
Platform string
|
||||
PlatformVersion string
|
||||
CPU []string
|
||||
MemTotal uint64
|
||||
DiskTotal uint64
|
||||
SwapTotal uint64
|
||||
Arch string
|
||||
Virtualization string
|
||||
BootTime uint64
|
||||
@@ -79,6 +73,9 @@ func (h *Host) PB() *pb.Host {
|
||||
Platform: h.Platform,
|
||||
PlatformVersion: h.PlatformVersion,
|
||||
Cpu: h.CPU,
|
||||
MemTotal: h.MemTotal,
|
||||
DiskTotal: h.DiskTotal,
|
||||
SwapTotal: h.SwapTotal,
|
||||
Arch: h.Arch,
|
||||
Virtualization: h.Virtualization,
|
||||
BootTime: h.BootTime,
|
||||
@@ -88,12 +85,16 @@ func (h *Host) PB() *pb.Host {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PB2Host ...
|
||||
func PB2Host(h *pb.Host) Host {
|
||||
return Host{
|
||||
Platform: h.GetPlatform(),
|
||||
PlatformVersion: h.GetPlatformVersion(),
|
||||
CPU: h.GetCpu(),
|
||||
MemTotal: h.GetMemTotal(),
|
||||
DiskTotal: h.GetDiskTotal(),
|
||||
SwapTotal: h.GetSwapTotal(),
|
||||
Arch: h.GetArch(),
|
||||
Virtualization: h.GetVirtualization(),
|
||||
BootTime: h.GetBootTime(),
|
||||
@@ -102,3 +103,6 @@ func PB2Host(h *pb.Host) Host {
|
||||
Version: h.GetVersion(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user