| | |
| | | } else { |
| | | map = new HashMap<>(); |
| | | } |
| | | |
| | | if (!monitor.getPingOnline()) { |
| | | try { |
| | | reachable = InetAddress.getByName(monitor.getIp()).isReachable(5000); |
| | |
| | | } |
| | | if (!monitor.getPingOnline()) { |
| | | offLineTimes++; |
| | | List<Date> offLineTime = monitor.getOffLineTime(); |
| | | if(CollectionUtils.isEmpty(offLineTime)) offLineTime = new ArrayList<>(); |
| | | offLineTime.add(new Date()); |
| | | monitor.setOffLineTime(offLineTime); |
| | | } |
| | | map.put("checkTimes", checkTimes); |
| | | map.put("offLineTimes", offLineTimes); |
| | |
| | | String status = ""; |
| | | if (! webReachable) { |
| | | status += "设备web访问失败;"; |
| | | }else if(webReachable){ |
| | | status += "设备web访问正常;"; |
| | | } |
| | | |
| | | if (! pingReachable) { |
| | | status += "设备ip未ping通;"; |
| | | }else if(pingReachable){ |
| | | status += "设备ipPing正常;"; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(imgUrl)) { |
| | | status += "未获取到图片"; |
| | | } |
| | | if (StringUtils.isEmpty(status)) { |
| | | status += "设备正常"; |
| | | }else { |
| | | status += "获取图片正常"; |
| | | } |
| | | result.setStatus(status); |
| | | return result; |