|
@@ -250,9 +250,9 @@ public class SerialNumberUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Map<String, String> getAllSn() {
|
|
|
- String os = System.getProperty("os.name");
|
|
|
+ String os = System.getProperty("os.name").toUpperCase();
|
|
|
Map<String, String> snVo = new HashMap<String, String>();
|
|
|
-
|
|
|
+ snVo.put("server.os", os);
|
|
|
if ("LINUX".equals(os)) {
|
|
|
System.out.println("=============>for linux");
|
|
|
String cpuid = getSerialNumber("dmidecode -t processor | grep 'ID'", "ID", ":");
|
|
@@ -262,26 +262,26 @@ public class SerialNumberUtil {
|
|
|
String diskNumber = getSerialNumber("fdisk -l", "Disk identifier", ":");
|
|
|
System.out.println("diskNumber : " + diskNumber);
|
|
|
// String mac = getSerialNumber("ifconfig -a", "ether", " ");
|
|
|
- snVo.put("cpuid", cpuid.toUpperCase().replace(" ", ""));
|
|
|
- snVo.put("diskid", diskNumber.toUpperCase().replace(" ", ""));
|
|
|
+ snVo.put("server.cpu", cpuid.toUpperCase().replace(" ", ""));
|
|
|
+ snVo.put("server.disk", diskNumber.toUpperCase().replace(" ", ""));
|
|
|
// snVo.put("mac", mac.toUpperCase().replace(" ", ""));
|
|
|
- snVo.put("mainboard", mainboardNumber.toUpperCase().replace(" ", ""));
|
|
|
+ snVo.put("server.mainboard", mainboardNumber.toUpperCase().replace(" ", ""));
|
|
|
} else {
|
|
|
System.out.println("=============>for windows");
|
|
|
String cpuid = SerialNumberUtil.getCPUSerial();
|
|
|
String mainboard = SerialNumberUtil.getMotherboardSN();
|
|
|
String disk = SerialNumberUtil.getHardDiskSN();
|
|
|
- String mac = SerialNumberUtil.getMac();
|
|
|
+ // String mac = SerialNumberUtil.getMac();
|
|
|
|
|
|
System.out.println("CPU SN:" + cpuid);
|
|
|
System.out.println("主板 SN:" + mainboard);
|
|
|
System.out.println("C盘 SN:" + disk);
|
|
|
- System.out.println("MAC SN:" + mac);
|
|
|
+ // System.out.println("MAC SN:" + mac);
|
|
|
|
|
|
- snVo.put("cpuid", cpuid.toUpperCase().replace(" ", ""));
|
|
|
- snVo.put("diskid", disk.toUpperCase().replace(" ", ""));
|
|
|
- snVo.put("mac", mac.toUpperCase().replace(" ", ""));
|
|
|
- snVo.put("mainboard", mainboard.toUpperCase().replace(" ", ""));
|
|
|
+ snVo.put("server.cpu", cpuid.toUpperCase().replace(" ", ""));
|
|
|
+ snVo.put("server.disk", disk.toUpperCase().replace(" ", ""));
|
|
|
+ // snVo.put("server.mac", mac.toUpperCase().replace(" ", ""));
|
|
|
+ snVo.put("server.mainboard", mainboard.toUpperCase().replace(" ", ""));
|
|
|
}
|
|
|
|
|
|
return snVo;
|