|
|
@ -65,14 +65,16 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator { |
|
|
|
if (splits.length != Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH){ |
|
|
|
if (splits.length != Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
String str = splits[0] + Constants.COMMA |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
+ splits[1] + Constants.COMMA |
|
|
|
sb.append(splits[0]).append(Constants.COMMA) |
|
|
|
+ OSUtils.cpuUsage() + Constants.COMMA |
|
|
|
.append(splits[1]).append(Constants.COMMA) |
|
|
|
+ OSUtils.memoryUsage() + Constants.COMMA |
|
|
|
.append(OSUtils.cpuUsage()).append(Constants.COMMA) |
|
|
|
+ OSUtils.loadAverage() + Constants.COMMA |
|
|
|
.append(OSUtils.memoryUsage()).append(Constants.COMMA) |
|
|
|
+ splits[5] + Constants.COMMA |
|
|
|
.append(OSUtils.loadAverage()).append(Constants.COMMA) |
|
|
|
+ DateUtils.dateToString(new Date()); |
|
|
|
.append(splits[5]).append(Constants.COMMA) |
|
|
|
zkClient.setData().forPath(znode,str.getBytes()); |
|
|
|
.append(DateUtils.dateToString(new Date())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zkClient.setData().forPath(znode, sb.toString().getBytes()); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("heartbeat for zk failed", e); |
|
|
|
logger.error("heartbeat for zk failed", e); |
|
|
|