try {
Connection conn = getConnection();
String result = callHostPluginPremium(conn, "check_heartbeat", "host", cmd.getHost().getGuid(), "interval",
Integer.toString(_heartbeatInterval * 2));
if (result == null) {
return new CheckOnHostAnswer(cmd, "Unable to call plugin");
}
if (result.contains("> DEAD <")) {
s_logger.debug("Heart beat is gone so dead.");
return new CheckOnHostAnswer(cmd, false, "Heart Beat is done");
} else if (result.contains("> ALIVE <")) {
s_logger.debug("Heart beat is still going");
return new CheckOnHostAnswer(cmd, true, "Heartbeat is still going");
}
return new CheckOnHostAnswer(cmd, null, "Unable to determine");
} catch (Exception e) {
s_logger.warn("Unable to fence", e);
return new CheckOnHostAnswer(cmd, e.getMessage());
}
}