@Override public Status isAgentAlive(Host agent) { if (s_logger.isDebugEnabled()) { s_logger.debug("checking if agent (" + agent.getId() + ") is alive"); } if (agent.getPodId() == null) { return null; } List<Long> otherHosts = findHostByPod(agent.getPodId(), agent.getId()); for (Long hostId : otherHosts) { if (s_logger.isDebugEnabled()) { s_logger.debug( "sending ping from (" + hostId + ") to agent's host ip address (" + agent.getPrivateIpAddress() + ")"); } Status hostState = testIpAddress(hostId, agent.getPrivateIpAddress()); if (hostState == null) { continue; } if (hostState == Status.Up) { if (s_logger.isDebugEnabled()) { s_logger.debug( "ping from (" + hostId + ") to agent's host ip address (" + agent.getPrivateIpAddress() + ") successful, returning that agent is disconnected"); } return Status .Disconnected; // the computing host ip is ping-able, but the computing agent is down, // report that the agent is disconnected } else if (hostState == Status.Down) { if (s_logger.isDebugEnabled()) { s_logger.debug("returning host state: " + hostState); } return hostState; } } // could not reach agent, could not reach agent's host, unclear what the problem is but it'll // require more investigation... if (s_logger.isDebugEnabled()) { s_logger.debug( "could not reach agent, could not reach agent's host, returning that we don't have enough information"); } return null; }
@Override public TrafficMonitorResponse getApiResponse(Host trafficMonitor) { Map<String, String> tmDetails = _detailsDao.findDetails(trafficMonitor.getId()); TrafficMonitorResponse response = new TrafficMonitorResponse(); response.setId(trafficMonitor.getUuid()); response.setIpAddress(trafficMonitor.getPrivateIpAddress()); response.setNumRetries(tmDetails.get("numRetries")); response.setTimeout(tmDetails.get("timeout")); return response; }