Search in sources :

Example 1 with DiagStatusResult

use of com.cubrid.cubridmanager.core.monitoring.model.DiagStatusResult in project cubrid-manager by CUBRID.

the class GetDiagdataTask method getResult.

/**
	 * Gets the instance of Type DiagStatusResult
	 * 
	 * @return DiagStatusResult
	 */
public DiagStatusResult getResult() {
    DiagStatusResult diagStatusResult = new DiagStatusResult();
    TreeNode node = getResponse();
    if (node == null || (getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        finish();
        return diagStatusResult;
    }
    for (TreeNode childNode : node.getChildren()) {
        setFieldValue(childNode, diagStatusResult);
    }
    return diagStatusResult;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) DiagStatusResult(com.cubrid.cubridmanager.core.monitoring.model.DiagStatusResult)

Example 2 with DiagStatusResult

use of com.cubrid.cubridmanager.core.monitoring.model.DiagStatusResult in project cubrid-manager by CUBRID.

the class StatusMonitorViewPart method getUpdateValue.

/**
	 * Get update value
	 * 
	 * @param startRun int
	 * @return Map<String, String>
	 */
private Map<String, String> getUpdateValue(int startRun) {
    GetDiagdataTask task = new GetDiagdataTask(site);
    if (dbName.trim().length() > 0) {
        task.setDbname(dbName);
    }
    List<String> monitorNameList = new ArrayList<String>();
    for (TargetConfig tc : monitorList) {
        monitorNameList.add(tc.getMonitorName());
    }
    task.buildMsg(monitorNameList);
    task.setUsingSpecialDelimiter(true);
    task.execute();
    Map<String, String> resultMap = null;
    if (!task.isSuccess()) {
        return null;
    }
    float inter = 0.0f;
    if (startRun == 0) {
        diagStatusResult = task.getResult();
        return diagStatusResult.getDiagStatusResultMap();
    } else if (startRun == 1) {
        lastSec = Calendar.getInstance();
        diagOldOneStatusResult.copy_from(diagStatusResult);
        diagStatusResult = task.getResult();
        DiagStatusResult diagStatusResultDelta = new DiagStatusResult();
        diagStatusResultDelta.getDelta(diagStatusResult, diagOldOneStatusResult);
        return diagStatusResultDelta.getDiagStatusResultMap();
    } else {
        nowSec = Calendar.getInstance();
        double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(3);
        inter = Float.parseFloat(nf.format(interval));
        LOGGER.debug("monitorTimes =" + monitorTimes);
        LOGGER.debug("lastSec time =" + lastSec.getTimeInMillis());
        LOGGER.debug("nowSec time =" + nowSec.getTimeInMillis());
        LOGGER.debug("inter =" + inter);
        lastSec = nowSec;
        diagOldTwoStatusResult.copy_from(diagOldOneStatusResult);
        diagOldOneStatusResult.copy_from(diagStatusResult);
        diagStatusResult = task.getResult();
        DiagStatusResult diagStatusResultDelta = new DiagStatusResult();
        diagStatusResultDelta.getDelta(diagStatusResult, diagOldOneStatusResult, diagOldTwoStatusResult, inter);
        resultMap = diagStatusResultDelta.getDiagStatusResultMap();
    }
    return resultMap;
}
Also used : GetDiagdataTask(com.cubrid.cubridmanager.core.monitoring.task.GetDiagdataTask) ArrayList(java.util.ArrayList) DiagStatusResult(com.cubrid.cubridmanager.core.monitoring.model.DiagStatusResult) NumberFormat(java.text.NumberFormat)

Aggregations

DiagStatusResult (com.cubrid.cubridmanager.core.monitoring.model.DiagStatusResult)2 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)1 GetDiagdataTask (com.cubrid.cubridmanager.core.monitoring.task.GetDiagdataTask)1 NumberFormat (java.text.NumberFormat)1 ArrayList (java.util.ArrayList)1