Search in sources :

Example 1 with BrokerDiagData

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

the class CommonQueryTaskTest method testTask.

public void testTask() {
    CommonQueryTask<StandbyServerStat> standbyServerStatTask = new CommonQueryTask<StandbyServerStat>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new StandbyServerStat(), "UTF-8");
    standbyServerStatTask.setDbName(testDbName);
    standbyServerStatTask.setDbid(dbaUserName);
    standbyServerStatTask.setDbpasswd(dbaPassword);
    standbyServerStatTask.execute();
    standbyServerStatTask.getResultModel();
    CommonQueryTask<BrokerDiagData> brokerDiagDataTask = new CommonQueryTask<BrokerDiagData>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), new BrokerDiagData());
    brokerDiagDataTask.setBName("query_editor");
    brokerDiagDataTask.execute();
    brokerDiagDataTask.getResultModel();
    brokerDiagDataTask.setBroker("query_editor");
    CommonQueryTask<KillTransactionList> task = new CommonQueryTask<KillTransactionList>(serverInfo, CommonSendMsg.getKillTransactionMSGItems(), new KillTransactionList());
    task.setDbName(testDbName);
    task.setKillTranType(KillTranType.H);
    task.setKillTranParameter("localhost");
}
Also used : KillTransactionList(com.cubrid.cubridmanager.core.cubrid.database.model.transaction.KillTransactionList) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) StandbyServerStat(com.cubrid.cubridmanager.core.mondashboard.model.StandbyServerStat)

Example 2 with BrokerDiagData

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

the class HostDashboardHistoryViewPart method loadBrokerChart.

/**
	 * Load an instance of ChartCompositePart stand for broker monitor info
	 *
	 * @param parent the instance of Composite
	 */
private void loadBrokerChart(Composite parent) {
    brokerComp = new Composite(parent, SWT.NULL);
    brokerComp.setLayout(new GridLayout());
    brokerComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    Group brokerGrp = new Group(brokerComp, SWT.NONE);
    brokerGrp.setText(Messages.hostBrokerSeriesGroupName);
    GridLayout layoutGrp = new GridLayout();
    layoutGrp.verticalSpacing = 0;
    layoutGrp.horizontalSpacing = 0;
    layoutGrp.marginLeft = 0;
    layoutGrp.marginRight = 0;
    layoutGrp.marginTop = 0;
    layoutGrp.marginBottom = 0;
    brokerGrp.setLayout(layoutGrp);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    brokerGrp.setLayoutData(gridData);
    BrokerDiagData brokerDiagData = new BrokerDiagData();
    TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
    brokerChartPart = new ChartCompositePart(brokerGrp, map);
    for (Map.Entry<String, String> entry : map.entrySet()) {
        String key = entry.getKey();
        ShowSetting showSetting = brokerChartPart.getSettingMap().get(key);
        ShowSettingMatching.match(key, showSetting, MonitorType.BROKER);
    }
    brokerChartPart.loadContent();
    JFreeChart chart = (JFreeChart) brokerChartPart.getChart();
    chart.setBorderVisible(false);
    XYPlot xyplot = (XYPlot) brokerChartPart.getChart().getPlot();
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setFixedAutoRange(300000d);
    dateaxis.setLowerMargin(0.0D);
    dateaxis.setUpperMargin(0.0D);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    renderer.setURLGenerator(null);
    renderer.setBaseToolTipGenerator(null);
}
Also used : Group(org.eclipse.swt.widgets.Group) DateAxis(org.jfree.chart.axis.DateAxis) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) JFreeChart(org.jfree.chart.JFreeChart) GridLayout(org.eclipse.swt.layout.GridLayout) XYPlot(org.jfree.chart.plot.XYPlot) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 3 with BrokerDiagData

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

the class BrokerDataProvider method performGetBrokerDiagDataTask.

/**
	 * 
	 * Perform "getbrokerdiagdata" task
	 * 
	 * @param brokerName String
	 * @return BrokerDiagData
	 */
public BrokerDiagData performGetBrokerDiagDataTask(String brokerName) {
    BrokerDiagData brokerDiagStatusResult = brokerDiagDataTask == null ? null : brokerDiagDataTask.getResultModel();
    if (brokerDiagStatusResult == null) {
        return null;
    }
    if (!brokerDiagStatusResult.getStatus()) {
        String detailMsg = "can not get session and active session and TPS information.";
        showErrorMsg(brokerDiagDataTask.getErrorMsg(), detailMsg);
        return null;
    }
    if (brokerdiagRequestCount == 0) {
        brokerDiagOldOneStatusResult = new BrokerDiagData();
        brokerDiagOldTwoStatusResult = new BrokerDiagData();
        brokerdiagRequestCount++;
        brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
    } else if (brokerdiagRequestCount == 1) {
        lastSec = Calendar.getInstance();
        BrokerDiagData brokerDiagDataDelta = new BrokerDiagData();
        brokerDiagDataDelta.getDelta(brokerDiagStatusResult, brokerDiagOldOneStatusResult);
        brokerdiagRequestCount++;
        brokerDiagOldTwoStatusResult.copyFrom(brokerDiagOldOneStatusResult);
        brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
    } else {
        nowSec = Calendar.getInstance();
        double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
        inter = (float) interval;
        lastSec = nowSec;
        BrokerDiagData latest = brokerDiagStatusResult.getSubBrokerByName(brokerName);
        BrokerDiagData oldOne = brokerDiagOldOneStatusResult.getSubBrokerByName(brokerName);
        BrokerDiagData oldTwo = brokerDiagOldTwoStatusResult.getSubBrokerByName(brokerName);
        if (latest == null || oldOne == null || oldTwo == null) {
            return null;
        }
        BrokerDiagData brokerDiagStatusResultDelta = new BrokerDiagData();
        brokerDiagStatusResultDelta.getDelta(latest, oldOne, oldTwo, inter);
        brokerDiagOldTwoStatusResult.copyFrom(brokerDiagOldOneStatusResult);
        brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
        return brokerDiagStatusResultDelta;
    }
    return null;
}
Also used : BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)

Example 4 with BrokerDiagData

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

the class BrokerNode method setBrokerDiagData.

/**
	 * Set BrokerDiagData
	 *
	 * @param diagStatusResult BrokerDiagData
	 */
public void setBrokerDiagData(BrokerDiagData diagStatusResult) {
    BrokerDiagData old = this.diagStatusResult;
    this.diagStatusResult = diagStatusResult;
    this.firePropertyChange(PROP_BROKER_STATUS, old, diagStatusResult);
}
Also used : BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)

Example 5 with BrokerDiagData

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

the class BrokerMonitorPart method refreshVisuals.

/**
	 * Refreshes this EditPart's <i>visuals</i>. This method is called by
	 * {@link #refresh()}, and may also be called in response to notifications
	 * from the model.
	 */
protected void refreshVisuals() {
    BrokerMonitorFigure figure = (BrokerMonitorFigure) this.getFigure();
    BrokerNode broker = (BrokerNode) this.getModel();
    setMode2View(figure, broker);
    BrokerDiagData dsr = broker.getBrokerDiagData();
    if (dsr == null) {
        figure.setSessionCount(0);
        figure.setActiveSessionCount(0);
        figure.setActiveSessionCount(0);
        figure.setTps(0);
    } else {
        figure.setSessionCount(Integer.parseInt(dsr.getCas_mon_session()));
        //Avoid looks like ActiveSessionCount larger then SessionCount
        figure.setActiveSessionCount(Integer.parseInt(dsr.getCas_mon_session()));
        figure.setActiveSessionCount(Integer.parseInt(dsr.getCas_mon_active()));
        figure.setTps(Integer.parseInt(dsr.getCas_mon_tran()));
    }
    super.refreshVisuals();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerMonitorFigure) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)

Aggregations

BrokerDiagData (com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)13 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)5 ShowSetting (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting)5 Map (java.util.Map)5 TreeMap (java.util.TreeMap)5 Composite (org.eclipse.swt.widgets.Composite)5 ChartCompositePart (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart)4 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)3 ArrayList (java.util.ArrayList)3 IPath (org.eclipse.core.runtime.IPath)3 XYPlot (org.jfree.chart.plot.XYPlot)3 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)2 List (java.util.List)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 JFreeChart (org.jfree.chart.JFreeChart)2 DateAxis (org.jfree.chart.axis.DateAxis)2