Search in sources :

Example 1 with DetectorManager

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

the class MonitorAgent method startAppServerMonitorDetector.

private void startAppServerMonitorDetector() {
    long detectInterval = DataConvertHelper.toLong(this.getConfigManager().getFeatureConfiguration(this.feature, "detector.interval"), 20000);
    // init DetectorManager
    DetectorManager appServerMonitorDetector_TimerWorker = new DetectorManager("AppServerMonitorDetector_TimerWorker", this.feature);
    boolean isContainerDetectEnable = DataConvertHelper.toBoolean(this.getConfigManager().getFeatureConfiguration(this.feature, "detector.container.scan.enable"), false);
    if (isContainerDetectEnable == true) {
        // init JVMContainerOSDetector
        JVMContainerOSDetector cosd = new JVMContainerOSDetector("JVMContainerOSDetector", this.feature, "modatahandlers", detectInterval);
        cosd.register("appserver", "com.creditease.agent.feature.monitoragent.datacatch.http.HttpAppServerMonitorDataCatchWorker");
        cosd.register("mscp", "com.creditease.agent.feature.monitoragent.datacatch.http.HttpMSCPMonitorDataCatchWorker");
        cosd.register("springboot", "com.creditease.agent.feature.monitoragent.datacatch.http.HttpSpringBootMonitorDataCatchWorker");
        // install JVMContainerOSDetector
        appServerMonitorDetector_TimerWorker.installDetector(cosd);
    }
    boolean isLocalOSDetectEnable = DataConvertHelper.toBoolean(this.getConfigManager().getFeatureConfiguration(this.feature, "detector.local.scan.enable"), true);
    if (isLocalOSDetectEnable == true) {
        // init JVMLocalOSDetector
        JVMLocalOSDetector asmd = new JVMLocalOSDetector("JVMLocalOSDetector", this.feature, "modatahandlers", detectInterval);
        asmd.register("appserver", "com.creditease.agent.feature.monitoragent.datacatch.jmx.JMXAppServerMonitorDataCatchWorker");
        asmd.register("mscp", "com.creditease.agent.feature.monitoragent.datacatch.jmx.JMXMSCPMonitorDataCatchWorker");
        asmd.register("unknown", "com.creditease.agent.feature.monitoragent.datacatch.jmx.JMXJavaMonitorDataCatchWorker");
        asmd.register("springboot", "com.creditease.agent.feature.monitoragent.datacatch.jmx.JMXSpringBootMonitorDataCatchWorker");
        // install JVMLocalOSDetector
        appServerMonitorDetector_TimerWorker.installDetector(asmd);
    }
    // start ApplicationServerMonitorDetector
    this.getTimerWorkManager().scheduleWork("AppServerMonitorDetector_TimerWorker", appServerMonitorDetector_TimerWorker, 0, detectInterval);
    if (log.isTraceEnable()) {
        log.info(this, "ApplicationServer MonitorDetector started");
    }
}
Also used : JVMContainerOSDetector(com.creditease.agent.feature.monitoragent.detect.JVMContainerOSDetector) JVMLocalOSDetector(com.creditease.agent.feature.monitoragent.detect.JVMLocalOSDetector) DetectorManager(com.creditease.agent.feature.monitoragent.detect.DetectorManager)

Example 2 with DetectorManager

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

the class LogProfileDataNotifyHandler method handle.

@Override
public void handle(MonitorDataFrame profileData) {
    /**
     * find out the logagent feature component and exchange the MDF
     */
    AgentFeatureComponent afc = (AgentFeatureComponent) this.getConfigManager().getComponent("logagent", "LogAgent");
    /**
     * NOTEļ¼šboth JMX and Http Scan supported
     */
    DetectorManager asmd = (DetectorManager) this.getConfigManager().getComponent(this.feature, "AppServerMonitorDetector_TimerWorker");
    if (null != afc && null != asmd) {
        JVMAgentInfo jvmAgentInfo = asmd.getJVMAgentInfo(profileData.getServerId());
        if (null == jvmAgentInfo) {
            log.warn(this, "can't find jvm agent info for serverid [" + profileData.getServerId() + "], the jvm may be dead.");
            return;
        }
        afc.exchange("logagent.profiledata.notify", profileData, jvmAgentInfo);
    } else {
        log.warn(this, "can't find agent feature component [logagent], this feature may not start. LogAgent-null(" + (afc == null) + "), DetectorManager-null(" + (asmd == null) + ")");
    }
}
Also used : JVMAgentInfo(com.creditease.agent.helpers.jvmtool.JVMAgentInfo) DetectorManager(com.creditease.agent.feature.monitoragent.detect.DetectorManager) AgentFeatureComponent(com.creditease.agent.spi.AgentFeatureComponent)

Aggregations

DetectorManager (com.creditease.agent.feature.monitoragent.detect.DetectorManager)2 JVMContainerOSDetector (com.creditease.agent.feature.monitoragent.detect.JVMContainerOSDetector)1 JVMLocalOSDetector (com.creditease.agent.feature.monitoragent.detect.JVMLocalOSDetector)1 JVMAgentInfo (com.creditease.agent.helpers.jvmtool.JVMAgentInfo)1 AgentFeatureComponent (com.creditease.agent.spi.AgentFeatureComponent)1