Commit 0f74c095 authored by Quxl's avatar Quxl

x

parent 0d99514f
package com.egolm.shop.util;
package com.egolm.collect.util;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -127,10 +126,10 @@ public class Usage {
CpuPerc cpuList[] = null;
cpuList = sigar.getCpuPercList();
for (int i = 0; i < infos.length; i++) {// 不管是单块CPU还是多CPU都适用
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<String, Object>();
CpuInfo info = infos[i];
CpuPerc cpu = cpuList[i];
map.put("CUP编号", i + 1);
map.put("编号", i + 1);
map.put("CPU的总量MHz", info.getMhz());
map.put("CPU生产商", info.getVendor());
map.put("CPU类别", info.getModel());
......@@ -211,6 +210,10 @@ public class Usage {
String name = ifNames[i];
NetInterfaceConfig ifconfig = sigar.getNetInterfaceConfig(name);
NetInterfaceStat ifstat = sigar.getNetInterfaceStat(name);
String ip = ifconfig.getAddress();
if("0.0.0.0".equals(ip)) {
continue;
}
map.put("网络设备名", name);// 网络设备名
map.put("IP地址", ifconfig.getAddress());// IP地址
map.put("子网掩码", ifconfig.getNetmask());// 子网掩码
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment