command.setAccessDetail(NetworkElementCommand.ROUTER_IP, router.getPrivateIpAddress());
try {
final Answer origAnswer = _agentMgr.easySend(router.getHostId(), command);
GetRouterAlertsAnswer answer = null;
if (origAnswer == null) {
s_logger.warn("Unable to get alerts from router " + router.getHostName());
continue;
}
if (origAnswer instanceof GetRouterAlertsAnswer) {
answer = (GetRouterAlertsAnswer)origAnswer;
} else {
s_logger.warn("Unable to get alerts from router " + router.getHostName());
continue;
}
if (!answer.getResult()) {
s_logger.warn("Unable to get alerts from router " + router.getHostName() + " " + answer.getDetails());
continue;
}
String alerts[] = answer.getAlerts();
if (alerts != null) {
String lastAlertTimeStamp = answer.getTimeStamp();
SimpleDateFormat sdfrmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
sdfrmt.setLenient(false);
try
{
sdfrmt.parse(lastAlertTimeStamp);