use of com.sohu.cache.server.data.Server in project cachecloud by sohutv.
the class ServerStatusCollector method collectServerStatus.
/**
* 收集系统状况
* @param ip
* @param session
*/
private void collectServerStatus(String ip, SSHSession session) {
final Server server = new Server();
server.setIp(ip);
Result result = session.executeCommand(COLLECT_SERVER_STATUS, new DefaultLineProcessor() {
public void process(String line, int lineNum) throws Exception {
server.parse(line, null);
}
});
if (!result.isSuccess()) {
logger.error("collect " + ip + " err:" + result.getResult(), result.getExcetion());
}
//保存服务器静态信息
serverDataService.saveAndUpdateServerInfo(server);
//保存服务器状况信息
serverDataService.saveServerStat(server);
}
Aggregations