mirror of
https://github.com/minio/minio.git
synced 2025-11-29 05:19:03 -05:00
Separate out memory statistics and system information into two different services
This commit is contained in:
@@ -47,8 +47,30 @@ func GetDisks(url string) ([]string, error) {
|
||||
return reply.Disks, nil
|
||||
}
|
||||
|
||||
// GetMemStats get system info of the server at given url
|
||||
// GetMemStats get memory status of the server at given url
|
||||
func GetMemStats(url string) ([]byte, error) {
|
||||
op := RPCOps{
|
||||
Method: "MemStats.Get",
|
||||
Request: rpc.Args{Request: ""},
|
||||
}
|
||||
req, err := NewRequest(url, op, http.DefaultTransport)
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
resp, err := req.Do()
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var reply rpc.MemStatsReply
|
||||
if err := jsonrpc.DecodeClientResponse(resp.Body, &reply); err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
return json.MarshalIndent(reply, "", "\t")
|
||||
}
|
||||
|
||||
// GetSysInfo get system status of the server at given url
|
||||
func GetSysInfo(url string) ([]byte, error) {
|
||||
op := RPCOps{
|
||||
Method: "SysInfo.Get",
|
||||
Request: rpc.Args{Request: ""},
|
||||
@@ -96,4 +118,4 @@ func SetDonut(url, hostname string, disks []string) error {
|
||||
return reply.Error
|
||||
}
|
||||
|
||||
// Add more functions here for many replies
|
||||
// Add more functions here for other RPC messages
|
||||
|
||||
Reference in New Issue
Block a user