新增获取磁盘主机的信息

This commit is contained in:
2025-08-24 17:03:42 +08:00
parent c55d3f619a
commit 79f0c62037
7 changed files with 114 additions and 16 deletions

View File

@@ -32,7 +32,6 @@ public final class HostInfo {
session = createSession(hostIp, port, username, password);
SysHost host = collectHost(session);
List<DiskMount> disks = collectDisk(session);
disks.forEach(d -> d.setSysHostId(host.getSysHostId()));
return new Result(host, disks);
} finally {
if (session != null && session.isConnected()) {
@@ -80,8 +79,6 @@ public final class HostInfo {
/* ========== 采集主机信息 ========== */
private static SysHost collectHost(Session session) throws Exception {
SysHost host = new SysHost();
String id = vId.getUid();
host.setSysHostId(id);
host.setHostTag(HOST_TAG);
host.setHostname(exec(session, "hostname -s"));
host.setCpuArch(exec(session, "uname -m"));

View File

@@ -1,7 +1,6 @@
package com.mini.capi.utils;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -30,7 +29,6 @@ public class vDate {
return dateTime.format(DateTimeFormatter.ofPattern(pattern));
}
public static String getNow() {
Date date = new Date();
return DEFAULT_SDF.format(date);