Search in sources :

Example 1 with AppServerProfileDataCatchWorker

use of com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker in project uavstack by uavorg.

the class MonitorAgent method startAppServerProfileCatchWorker.

private void startAppServerProfileCatchWorker() {
    AppServerProfileDataCatchWorker apdc = new AppServerProfileDataCatchWorker("AppServerProfileDataCatchWorker", this.feature, "prodatahandlers");
    // start AppServerProfileDataCatchWorker
    profileThread = new Thread(apdc);
    profileThread.start();
    if (log.isTraceEnable()) {
        log.info(this, "ApplicationServer ProfileDataCatchWorker started");
    }
}
Also used : AppServerProfileDataCatchWorker(com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker)

Example 2 with AppServerProfileDataCatchWorker

use of com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker in project uavstack by uavorg.

the class BaseHttpMonitorDataCatchWorker method run.

@Override
public void run() {
    try {
        boolean needProcessCheck = true;
        long timeFlag = (System.currentTimeMillis() / 10) * 10;
        // get all monitor's MBean
        MonitorDataFrame mdf = new MonitorDataFrame(this.getWorkerId(), "M", timeFlag);
        needProcessCheck = doCaptureMonitorData(timeFlag, mdf);
        // if needProcessCheck is still true, need see if the appserver is still alive
        if (needProcessCheck == true) {
            doHealthReaction();
            return;
        } else {
            /**
             * if there is data, we handle MDF using monitor data handler to process the monitor data
             */
            if (!mdf.isEmpty()) {
                List<MonitorDataFrame> ml = new ArrayList<MonitorDataFrame>();
                ml.add(mdf);
                this.detector.runHandlers(ml);
            }
        }
        // get all profile's MBean
        MonitorDataFrame pmdf = new MonitorDataFrame(this.getWorkerId(), "P", timeFlag);
        needProcessCheck = doCaptureProfileData(timeFlag, pmdf);
        // if needProcessCheck is still true, need see if the appserver is still alive
        if (needProcessCheck == true) {
            doHealthReaction();
            return;
        } else {
            /**
             * if there is data, we handle MDF
             */
            if (!pmdf.isEmpty()) {
                /**
                 * as profile data is low frequency data, then we just need 1 thread for all appservers on the same
                 * host machine to publish the data
                 */
                AppServerProfileDataCatchWorker apdc = (AppServerProfileDataCatchWorker) this.getConfigManager().getComponent(this.feature, "AppServerProfileDataCatchWorker");
                apdc.putData(pmdf);
            }
        }
    } catch (IOException e) {
        // if connect fails, try process detecting
        doHealthReaction();
    }
}
Also used : ArrayList(java.util.ArrayList) AppServerProfileDataCatchWorker(com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker) MonitorDataFrame(com.creditease.agent.monitor.api.MonitorDataFrame) IOException(java.io.IOException)

Example 3 with AppServerProfileDataCatchWorker

use of com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker in project uavstack by uavorg.

the class JMXAppServerMonitorDataCatchWorker method run.

@Override
public void run() {
    try {
        boolean needProcessCheck = true;
        long timeFlag = (System.currentTimeMillis() / 10) * 10;
        // get all monitor's MBean
        MonitorDataFrame mdf = new MonitorDataFrame(this.getWorkerId(), "M", timeFlag);
        needProcessCheck = doCaptureMonitorData(mbsc, timeFlag, mdf);
        // if needProcessCheck is still true, need see if the appserver is still alive
        if (needProcessCheck == true) {
            doHealthReaction();
            return;
        } else {
            /**
             * if there is data, we handle MDF using monitor data handler to process the monitor data
             */
            if (!mdf.isEmpty()) {
                List<MonitorDataFrame> ml = new ArrayList<MonitorDataFrame>();
                ml.add(mdf);
                this.detector.runHandlers(ml);
            }
        }
        // get all profile's MBean
        MonitorDataFrame pmdf = new MonitorDataFrame(this.getWorkerId(), "P", timeFlag);
        needProcessCheck = doCaptureProfileData(mbsc, timeFlag, pmdf);
        // if needProcessCheck is still true, need see if the appserver is still alive
        if (needProcessCheck == true) {
            doHealthReaction();
            return;
        } else {
            /**
             * if there is data, we handle MDF
             */
            if (!pmdf.isEmpty()) {
                /**
                 * as profile data is low frequency data, then we just need 1 thread for all appservers on the same
                 * host machine to publish the data
                 */
                AppServerProfileDataCatchWorker apdc = (AppServerProfileDataCatchWorker) this.getConfigManager().getComponent(this.feature, "AppServerProfileDataCatchWorker");
                apdc.putData(pmdf);
            }
        }
    } catch (IOException e) {
        // if connect fails, try process detecting
        doHealthReaction();
    }
}
Also used : ArrayList(java.util.ArrayList) AppServerProfileDataCatchWorker(com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker) MonitorDataFrame(com.creditease.agent.monitor.api.MonitorDataFrame) IOException(java.io.IOException)

Example 4 with AppServerProfileDataCatchWorker

use of com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker in project uavstack by uavorg.

the class JMXJavaMonitorDataCatchWorker method doCaptureProfileData.

/**
 * --------------------------------------------Profile Data----------------------------------------------------
 */
/**
 * TODO: doCaptureProfileData
 *
 * every 1 minute to send the profile data as heartbeat
 *
 * @param timeFlag
 */
private void doCaptureProfileData(long timeFlag) {
    MonitorDataFrame pmdf = new MonitorDataFrame(this.getWorkerId(), "P", timeFlag);
    if (state.getProfileTimestamp() == 0) {
        state.setProfileTimestamp(System.currentTimeMillis());
    } else {
        long curTime = System.currentTimeMillis();
        if (curTime - state.getProfileTimestamp() < profileHBTimeout) {
            return;
        }
        pmdf.setTag("P:HB");
        state.setProfileTimestamp(curTime);
    }
    // get Profile MDF
    this.buildProfileMDF(pmdf);
    if (!pmdf.isEmpty()) {
        /**
         * as profile data is low frequency data, then we just need 1 thread for all appservers on the same host
         * machine to publish the data
         */
        AppServerProfileDataCatchWorker apdc = (AppServerProfileDataCatchWorker) this.getConfigManager().getComponent(this.feature, "AppServerProfileDataCatchWorker");
        apdc.putData(pmdf);
    }
}
Also used : AppServerProfileDataCatchWorker(com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker) MonitorDataFrame(com.creditease.agent.monitor.api.MonitorDataFrame)

Aggregations

AppServerProfileDataCatchWorker (com.creditease.agent.feature.monitoragent.AppServerProfileDataCatchWorker)4 MonitorDataFrame (com.creditease.agent.monitor.api.MonitorDataFrame)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2