|
|
@ -29,13 +29,20 @@ type SysInfoService struct{} |
|
|
|
|
|
|
|
|
|
|
|
// SysInfoReply -
|
|
|
|
// SysInfoReply -
|
|
|
|
type SysInfoReply struct { |
|
|
|
type SysInfoReply struct { |
|
|
|
Hostname string `json:"hostname"` |
|
|
|
Hostname string `json:"hostname"` |
|
|
|
SysARCH string `json:"sys.arch"` |
|
|
|
SysARCH string `json:"sys.arch"` |
|
|
|
SysOS string `json:"sys.os"` |
|
|
|
SysOS string `json:"sys.os"` |
|
|
|
SysCPUS int `json:"sys.ncpus"` |
|
|
|
SysCPUS int `json:"sys.ncpus"` |
|
|
|
Routines int `json:"goroutines"` |
|
|
|
Routines int `json:"goroutines"` |
|
|
|
GOVersion string `json:"goversion"` |
|
|
|
GOVersion string `json:"goversion"` |
|
|
|
MemStats runtime.MemStats `json:"memstats"` |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MemStatsService -
|
|
|
|
|
|
|
|
type MemStatsService struct{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MemStatsReply -
|
|
|
|
|
|
|
|
type MemStatsReply struct { |
|
|
|
|
|
|
|
runtime.MemStats `json:"memstats"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func setSysInfoReply(sis *SysInfoReply) error { |
|
|
|
func setSysInfoReply(sis *SysInfoReply) error { |
|
|
@ -50,11 +57,13 @@ func setSysInfoReply(sis *SysInfoReply) error { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return iodine.New(err, nil) |
|
|
|
return iodine.New(err, nil) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func setMemStatsReply(sis *MemStatsReply) error { |
|
|
|
var memStats runtime.MemStats |
|
|
|
var memStats runtime.MemStats |
|
|
|
runtime.ReadMemStats(&memStats) |
|
|
|
runtime.ReadMemStats(&memStats) |
|
|
|
sis.MemStats = memStats |
|
|
|
sis.MemStats = memStats |
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -62,3 +71,8 @@ func setSysInfoReply(sis *SysInfoReply) error { |
|
|
|
func (s *SysInfoService) Get(r *http.Request, args *Args, reply *SysInfoReply) error { |
|
|
|
func (s *SysInfoService) Get(r *http.Request, args *Args, reply *SysInfoReply) error { |
|
|
|
return setSysInfoReply(reply) |
|
|
|
return setSysInfoReply(reply) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get method
|
|
|
|
|
|
|
|
func (s *MemStatsService) Get(r *http.Request, args *Args, reply *MemStatsReply) error { |
|
|
|
|
|
|
|
return setMemStatsReply(reply) |
|
|
|
|
|
|
|
} |
|
|
|