use of com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method decorateDatabaseImgae.
/**
* Decorate the database image
*
* @param label
* @param server
* @return
*/
private Image decorateDatabaseImgae(Image baseImage, CubridDatabase database) {
CubridServer server = database.getServer();
HAHostStatusInfo haHostStatusInfo = server.getServerInfo().getHaHostStatusInfo();
HADatabaseStatusInfo haDatabaseStatusInfo = HAUtil.getHADatabaseStatusInfo(database.getName(), haHostStatusInfo, server.getServerInfo());
List<String> haNodeList = HAUtil.getAllHaDBList(server.getServerInfo());
server.getLoader().setLoaded(true);
if (haNodeList.contains(database.getName())) {
DBStatusType statusType = haDatabaseStatusInfo.getStatusType();
if (DBStatusType.ACTIVE.equals(statusType)) {
DecoratedImage decoratedImage = decoratorManager.decorate(baseImage, "HADatabase", null, null, null, null, null, null, imgDecMaster, "Active");
return decoratedImage.getDecoratedImage();
}
if (DBStatusType.STANDBY.equals(statusType)) {
DecoratedImage decoratedImage = decoratorManager.decorate(baseImage, "HADatabase", null, null, null, null, null, null, imgDecSlave, "Standby");
return decoratedImage.getDecoratedImage();
}
}
return baseImage;
}
use of com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method decorateServerText.
/**
* Decorate the server lable
*
* @param label
* @param server
* @return
*/
private String decorateServerText(String label, CubridServer server) {
StringBuilder sb = new StringBuilder();
sb.append(label);
if (server.isConnected()) {
HAHostStatusInfo haHostStatusInfo = server.getServerInfo().getHaHostStatusInfo();
if (haHostStatusInfo != null) {
if (HostStatusType.REPLICA.equals(haHostStatusInfo.getStatusType())) {
sb.append(" - [").append(Messages.lblServerReplica).append("]");
}
if (HostStatusType.UNKNOWN.equals(haHostStatusInfo.getStatusType())) {
sb.append(" - [").append(Messages.lblServerUnknow).append("]");
}
}
}
return sb.toString();
}
use of com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo in project cubrid-manager by CUBRID.
the class ServiceDashboardLabelProvider method decorateServerText.
/**
* Decorate the server lable
*
* @param label
* @param server
* @return
*/
private String decorateServerText(String label, CubridServer server) {
StringBuilder sb = new StringBuilder();
sb.append(label);
if (server.isConnected()) {
HAHostStatusInfo haHostStatusInfo = server.getServerInfo().getHaHostStatusInfo();
if (haHostStatusInfo != null) {
if (HostStatusType.MASTER.equals(haHostStatusInfo.getStatusType())) {
sb.append(" - [").append(com.cubrid.cubridmanager.ui.common.Messages.lblServerMaster).append("]");
}
if (HostStatusType.SLAVE.equals(haHostStatusInfo.getStatusType())) {
sb.append(" - [").append(com.cubrid.cubridmanager.ui.common.Messages.lblServerSlave).append("]");
}
if (HostStatusType.REPLICA.equals(haHostStatusInfo.getStatusType())) {
sb.append(" - [").append(com.cubrid.cubridmanager.ui.common.Messages.lblServerReplica).append("]");
}
if (HostStatusType.UNKNOWN.equals(haHostStatusInfo.getStatusType())) {
sb.append(" - [").append(com.cubrid.cubridmanager.ui.common.Messages.lblServerUnknow).append("]");
}
}
}
return sb.toString();
}
use of com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo in project cubrid-manager by CUBRID.
the class CubridServerLoader method getHostStatus.
/**
* Get host status
*
* @param server - CubridServer
*/
private void getHostStatus(final CubridServer server) {
final GetHeartbeatNodeInfoTask getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(server.getServerInfo());
getHeartbeatNodeInfoTask.setAllDb(true);
getHeartbeatNodeInfoTask.execute();
if (getHeartbeatNodeInfoTask.isSuccess()) {
HAHostStatusInfo haHostStatusInfo = getHeartbeatNodeInfoTask.getHostStatusInfo(server.getServerInfo().getHostAddress());
if (haHostStatusInfo != null) {
server.getServerInfo().setHaHostStatusInfo(haHostStatusInfo);
}
} else {
LOGGER.debug("Get host status error:" + getHeartbeatNodeInfoTask.getErrorMsg());
}
final GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(server.getServerInfo());
getHAConfParameterTask.execute();
if (getHAConfParameterTask.isSuccess()) {
server.getServerInfo().setHaConfParaMap(getHAConfParameterTask.getConfParameters());
} else {
LOGGER.debug("Get host ha status error:" + getHAConfParameterTask.getErrorMsg());
}
}
use of com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo in project cubrid-manager by CUBRID.
the class HostMonitorPartHelper method performUpdate.
/**
* Perform the update data
*
* @param dataChangedEvent the given event including newest data
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
DataProvider dataProvider = (DataProvider) dataChangedEvent.getSource();
if (dataProvider != null && dataProvider.getServerInfo() != null) {
hostNode.setConnected(dataProvider.getServerInfo().isConnected());
}
if (!hostNode.isConnected()) {
hostNode.setConnected(false);
HAHostStatusInfo haHostStatusInfo = new HAHostStatusInfo();
haHostStatusInfo.setIp(hostNode.getIp());
hostNode.setHostStatusInfo(haHostStatusInfo);
return;
}
HAHostStatusInfo haHostStatusInfo = HAUtil.getHostStatusInfo(dataChangedEvent.getHaHostStatusInfoList(), hostNode.getIp());
if (haHostStatusInfo == null) {
haHostStatusInfo = HAUtil.getHAHostStatusInfo(hostNode.getServerInfo());
if (haHostStatusInfo == null) {
haHostStatusInfo = new HAHostStatusInfo();
haHostStatusInfo.setIp(hostNode.getIp());
}
}
Set<MondashDataResult> set = dataChangedEvent.getResultSet();
Map<IDiagPara, String> map = null;
for (MondashDataResult result : set) {
if (generator.getName().equals(result.getName())) {
map = result.getUpdateMap();
break;
}
}
int[] value = getValues(map);
haHostStatusInfo.setCpuUsage(value[0]);
haHostStatusInfo.setMemUsage(value[1]);
haHostStatusInfo.setIoWait(value[2]);
hostNode.setHostStatusInfo(haHostStatusInfo);
}
Aggregations