Search in sources :

Example 11 with HAHostStatusInfo

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;
}
Also used : DecoratedImage(com.cubrid.common.ui.decorator.DecoratedImage) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) StyledString(org.eclipse.jface.viewers.StyledString) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Example 12 with HAHostStatusInfo

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();
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)

Example 13 with HAHostStatusInfo

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();
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)

Example 14 with HAHostStatusInfo

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());
    }
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) GetHeartbeatNodeInfoTask(com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask)

Example 15 with HAHostStatusInfo

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);
}
Also used : DataProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) MondashDataResult(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.MondashDataResult) IDiagPara(com.cubrid.cubridmanager.core.monitoring.model.IDiagPara)

Aggregations

HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)19 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)7 ArrayList (java.util.ArrayList)6 DBStatusType (com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType)4 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)4 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)3 HashMap (java.util.HashMap)3 List (java.util.List)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 RowLayout (org.eclipse.swt.layout.RowLayout)3 Button (org.eclipse.swt.widgets.Button)3 Composite (org.eclipse.swt.widgets.Composite)3 Label (org.eclipse.swt.widgets.Label)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)2