| | |
| | | |
| | | try { |
| | | result.setIpAddress(this.getIpAddress()); |
| | | }catch (Exception e){ |
| | | logger.error("获取服务器IP失败",e); |
| | | } |
| | | |
| | | try { |
| | | result.setMacAddress(this.getMacAddress()); |
| | | }catch (Exception e){ |
| | | logger.error("获取服务器MAC失败",e); |
| | | } |
| | | |
| | | try { |
| | | result.setCpuSerial(this.getCPUSerial()); |
| | | }catch (Exception e){ |
| | | logger.error("获取服务器CPU序列号失败",e); |
| | | } |
| | | |
| | | try { |
| | | result.setMainBoardSerial(this.getMainBoardSerial()); |
| | | }catch (Exception e){ |
| | | logger.error("获取服务器硬件信息失败",e); |
| | | logger.error("获取服务器主板序列号失败",e); |
| | | } |
| | | |
| | | return result; |
| | |
| | | protected String getMacByInetAddress(InetAddress inetAddr){ |
| | | try { |
| | | byte[] mac = NetworkInterface.getByInetAddress(inetAddr).getHardwareAddress(); |
| | | if (mac == null) { |
| | | return null; |
| | | } |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | |
| | | for(int i=0;i<mac.length;i++){ |
| | |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | } |