feat: NEZ-2142 nz-talon oshi 接口开发
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user