|
@@ -100,7 +100,7 @@ public class SshUtil {
|
|
|
/**
|
|
|
* 获取 cpu 使用率
|
|
|
*/
|
|
|
- public static double cpu(ClientSession session) throws IOException, InterruptedException {
|
|
|
+ public static double cpuUsage(ClientSession session) throws IOException, InterruptedException {
|
|
|
|
|
|
Map<?, ?> map1 = cpuInfo(session);
|
|
|
Thread.sleep(5 * 1000);
|
|
@@ -164,7 +164,7 @@ public class SshUtil {
|
|
|
/**
|
|
|
* 功能:CPU使用信息
|
|
|
*/
|
|
|
- public static List<Gpu> gpu(ClientSession session) throws IOException, DocumentException {
|
|
|
+ public static List<Gpu> gpuInfo(ClientSession session) throws IOException, DocumentException {
|
|
|
String execute = SshUtil.execute(session, "nvidia-smi -q -x");
|
|
|
String REG = "<!DOCTYPE.*.dtd\">";
|
|
|
execute = execute.replaceAll(REG, "");
|
|
@@ -208,9 +208,10 @@ public class SshUtil {
|
|
|
/**
|
|
|
* 内存使用率
|
|
|
*
|
|
|
+ * @param session 会话
|
|
|
* @return 剩余可用内存
|
|
|
*/
|
|
|
- public static double memory0(ClientSession session) throws IOException {
|
|
|
+ public static double memoryUsage(ClientSession session) throws IOException {
|
|
|
String execute = SshUtil.execute(session, "cat /proc/meminfo");
|
|
|
String[] split = execute.split("\n");
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -241,9 +242,10 @@ public class SshUtil {
|
|
|
/**
|
|
|
* 剩余可用内存
|
|
|
*
|
|
|
+ * @param session 会话
|
|
|
* @return 剩余可用内存
|
|
|
*/
|
|
|
- public static double memory1(ClientSession session) throws IOException {
|
|
|
+ public static double memoryAvailable(ClientSession session) throws IOException {
|
|
|
String execute = SshUtil.execute(session, "cat /proc/meminfo");
|
|
|
String[] split = execute.split("\n");
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -278,7 +280,7 @@ public class SshUtil {
|
|
|
* @param session 会话
|
|
|
* @return 磁盘使用率
|
|
|
*/
|
|
|
- public static double disk0(ClientSession session) throws IOException {
|
|
|
+ public static double diskUsage(ClientSession session) throws IOException {
|
|
|
String execute = execute(session, "df --total");
|
|
|
String[] split = execute.split("\n");
|
|
|
String[] split1 = split[split.length - 1].split("\\s+");
|
|
@@ -291,9 +293,11 @@ public class SshUtil {
|
|
|
|
|
|
/**
|
|
|
* 剩余可用磁盘
|
|
|
+ *
|
|
|
+ * @param session 会话
|
|
|
* @return 剩余可用磁盘
|
|
|
*/
|
|
|
- public static double disk1(ClientSession session) throws IOException {
|
|
|
+ public static double diskAvailable(ClientSession session) throws IOException {
|
|
|
String execute = execute(session, "df --total");
|
|
|
String[] split = execute.split("\n");
|
|
|
String[] split1 = split[split.length - 1].split("\\s+");
|