feat: NEZ-2142 nz-talon oshi 接口开发

This commit is contained in:
zhangshuai
2022-08-24 17:49:51 +08:00
parent b773755d92
commit 42589f6477
3 changed files with 250 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package net.geedge.confagent.controller;
import net.geedge.confagent.util.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class OSHIController extends BaseController{
@GetMapping("/oshi/info")
public R getSystemInfo(HttpServletRequest request){
Map<String, Object> systemInfo = OSHIUtils.getSystemInfo();
return R.ok(systemInfo);
}
@GetMapping("/oshi/process")
public R getProcessInfo(HttpServletRequest request){
List<Map> result = OSHIUtils.getProcessInfo();
HashMap<Object, Object> data = Tool.MapUtil.newHashMap();
data.put("lsit" ,result);
return R.ok(data);
}
@GetMapping("/oshi/netstat")
public R getNetstatInfo(HttpServletRequest request) throws UnknownHostException {
List<Map> result = OSHIUtils.getNetInfo();
HashMap<Object, Object> data = Tool.MapUtil.newHashMap();
data.put("lsit" ,result);
return R.ok(data);
}
}