use of com.cloud.agent.api.routing.GetRouterMonitorResultsCommand in project cloudstack by apache.
the class VirtualNetworkApplianceManagerImpl method performBasicTestsOnRouter.
private GetRouterMonitorResultsAnswer performBasicTestsOnRouter(DomainRouterVO router) {
if (!RouterHealthChecksEnabled.value()) {
return null;
}
String controlIP = _routerControlHelper.getRouterControlIp(router.getId());
if (StringUtils.isNotBlank(controlIP) && !controlIP.equals("0.0.0.0")) {
final GetRouterMonitorResultsCommand command = new GetRouterMonitorResultsCommand(false, true);
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlIP);
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
try {
final Answer answer = _agentMgr.easySend(router.getHostId(), command);
if (answer == null) {
s_logger.warn("Unable to fetch basic router test results data from router " + router.getHostName());
return null;
}
if (answer instanceof GetRouterMonitorResultsAnswer) {
return (GetRouterMonitorResultsAnswer) answer;
} else {
s_logger.warn("Unable to fetch basic router test results from router " + router.getHostName() + " Received answer " + answer.getDetails());
return new GetRouterMonitorResultsAnswer(command, false, null, answer.getDetails());
}
} catch (final Exception e) {
s_logger.warn("Error while performing basic tests on router: " + router.getInstanceName(), e);
return null;
}
}
return null;
}
use of com.cloud.agent.api.routing.GetRouterMonitorResultsCommand in project cloudstack by apache.
the class VirtualNetworkApplianceManagerImpl method fetchAndUpdateRouterHealthChecks.
private GetRouterMonitorResultsAnswer fetchAndUpdateRouterHealthChecks(DomainRouterVO router, boolean performFreshChecks) {
if (!RouterHealthChecksEnabled.value()) {
return null;
}
String controlIP = _routerControlHelper.getRouterControlIp(router.getId());
if (StringUtils.isNotBlank(controlIP) && !controlIP.equals("0.0.0.0")) {
final GetRouterMonitorResultsCommand command = new GetRouterMonitorResultsCommand(performFreshChecks, false);
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlIP);
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
try {
final Answer answer = _agentMgr.easySend(router.getHostId(), command);
if (answer == null) {
s_logger.warn("Unable to fetch monitoring results data from router " + router.getHostName());
return null;
}
if (answer instanceof GetRouterMonitorResultsAnswer) {
return (GetRouterMonitorResultsAnswer) answer;
} else {
s_logger.warn("Unable to fetch health checks results to router " + router.getHostName() + " Received answer " + answer.getDetails());
return new GetRouterMonitorResultsAnswer(command, false, null, answer.getDetails());
}
} catch (final Exception e) {
s_logger.warn("Error while collecting alerts from router: " + router.getInstanceName(), e);
return null;
}
}
return null;
}
Aggregations