use of com.creditease.agent.spi.AgentFeatureComponent 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) + ")");
}
}
use of com.creditease.agent.spi.AgentFeatureComponent in project uavstack by uavorg.
the class LogNodeOperAction method doAction.
@Override
public void doAction(ActionContext context) throws Exception {
AgentFeatureComponent afc = (AgentFeatureComponent) getConfigManager().getComponent(feature, "LogAgent");
if (afc == null) {
return;
}
UAVHttpMessage data = (UAVHttpMessage) context.getParam("msg");
String strategy = data.getRequest("strategy");
try {
afc.exchange("logagent.strategy", strategy);
data.putResponse("rs", "OK");
} catch (Exception e) {
log.err(this, "exchange logagent strategy FAILED. " + strategy, e);
data.putResponse("rs", "ERR");
data.putResponse("msg", "设置日志抓取策略出错!");
}
}
use of com.creditease.agent.spi.AgentFeatureComponent in project uavstack by uavorg.
the class RuntimeDataMessageHandler method handle.
@Override
public void handle(Message msg) {
String dataStream = msg.getParam(getMsgTypeName());
AgentFeatureComponent rn = (AgentFeatureComponent) ConfigurationManager.getInstance().getComponent("runtimenotify", "RuntimeNotifyCatcher");
if (rn != null) {
rn.exchange("runtime.notify", dataStream, false);
}
}
use of com.creditease.agent.spi.AgentFeatureComponent in project uavstack by uavorg.
the class NotificationMessageHandler method handle.
@Override
public void handle(Message msg) {
super.handle(msg);
// exchange msg to NotifyCenter
AgentFeatureComponent afc = (AgentFeatureComponent) ConfigurationManager.getInstance().getComponent("notifycenter", "NotificationCenter");
if (null != afc) {
String notifyDataArrayStr = msg.getParam(getMsgTypeName());
afc.exchange("notify.center.put", notifyDataArrayStr);
}
}
use of com.creditease.agent.spi.AgentFeatureComponent in project uavstack by uavorg.
the class MOFCtrlAction method doCollectFiles.
/**
* Do Action which require Collect Client
*
* @param data
* @param response
* @param collectAct
*/
@SuppressWarnings("unchecked")
private void doCollectFiles(UAVHttpMessage data, final StringBuilder response, String rootPath) {
AgentFeatureComponent afc = (AgentFeatureComponent) this.getConfigManager().getComponent("collectclient", "CollectDataAgent");
if (afc == null) {
data.putResponse("rs", "ERR");
data.putResponse("msg", "归集客户端未启动");
return;
}
String collectAct = data.getRequest("collectact");
Map<String, String> respObj = JSONHelper.toObject(response.toString(), Map.class);
File rootFile = new File(respObj.get(rootPath));
String filePattern = rootFile.getAbsolutePath().replace("\\", "/") + "/" + data.getRequest("file") + ".0.log";
String appUUID = data.getRequest("appuuid");
String mqTopic = data.getRequest("mq");
String collectTasks = "{\"tasks\": [ {\"target\": \"" + appUUID + "\", \"action\": \"" + mqTopic + "\", \"file\": \"" + filePattern + "\", \"topic\":\"" + mqTopic + "\"} ]}";
afc.exchange(collectAct, collectTasks);
data.putResponse("rs", "OK");
data.putResponse("msg", respObj.get("rs"));
}
Aggregations