diff --git a/aufs/core/dtmem.go b/aufs/core/dtmem.go index 5232862..d4bb01f 100644 --- a/aufs/core/dtmem.go +++ b/aufs/core/dtmem.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "net/http" + "net/rpc/jsonrpc" "runtime" ) @@ -17,6 +18,23 @@ func Dtmem(w http.ResponseWriter, r *http.Request) { var m runtime.MemStats runtime.ReadMemStats(&m) + // 测试JSONRPC + service := "192.168.66.16:9098" + client, err := jsonrpc.Dial("tcp", service) + if err != nil { + fmt.Fprintf(w, "jsonrpc dial faild %v", err) + return + } + // 调用远程方法 + var reply int + err = client.Call("Service.GetFilePath", "hello", &reply) + if err != nil { + fmt.Fprintf(w, "jsonrpc call faild %v", err) + return + } + // 打印返回值 + fmt.Fprintf(w, "jsonrpc call success, reply: %d", reply) + dtm := Dtm{ TotalAlloc: fmt.Sprintf("%d", m.TotalAlloc), diff --git a/scagent/.gitignore b/scagent/.gitignore index 5292519..c914a0b 100644 --- a/scagent/.gitignore +++ b/scagent/.gitignore @@ -1 +1,2 @@ -logs/ \ No newline at end of file +logs/ +scagent \ No newline at end of file