[ server ] - monitor all agent status - 3
This commit is contained in:
@@ -3,6 +3,7 @@ package io.wdd.agent.config.message.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.wdd.agent.status.AgentStatusCollector;
|
||||
import io.wdd.agent.status.HealthyReporter;
|
||||
import io.wdd.common.beans.rabbitmq.OctopusMessage;
|
||||
import io.wdd.common.beans.rabbitmq.OctopusMessageType;
|
||||
@@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static io.wdd.common.beans.status.OctopusStatusMessage.HEALTHY_STATUS_MESSAGE_TYPE;
|
||||
import static io.wdd.common.beans.status.OctopusStatusMessage.*;
|
||||
|
||||
@Component
|
||||
public class OMHandlerStatus extends AbstractOctopusMessageHandler {
|
||||
@@ -22,6 +23,9 @@ public class OMHandlerStatus extends AbstractOctopusMessageHandler {
|
||||
@Resource
|
||||
HealthyReporter healthyReporter;
|
||||
|
||||
@Resource
|
||||
AgentStatusCollector agentStatusCollector;
|
||||
|
||||
@Override
|
||||
public boolean handle(OctopusMessage octopusMessage) {
|
||||
|
||||
@@ -40,6 +44,16 @@ public class OMHandlerStatus extends AbstractOctopusMessageHandler {
|
||||
if (statusType.equals(HEALTHY_STATUS_MESSAGE_TYPE)) {
|
||||
// healthy check
|
||||
healthyReporter.report();
|
||||
} else if (statusType.equals(ALL_STATUS_MESSAGE_TYPE)) {
|
||||
// all status report
|
||||
agentStatusCollector.sendAgentStatusToRedis();
|
||||
} else if (statusType.equals(METRIC_STATUS_MESSAGE_TYPE)) {
|
||||
// metric status
|
||||
} else if (statusType.equals(APP_STATUS_MESSAGE_TYPE)) {
|
||||
// app status report
|
||||
} else {
|
||||
// unknown
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +61,6 @@ public class OMHandlerStatus extends AbstractOctopusMessageHandler {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class AgentStatusCollector {
|
||||
|
||||
// agent boot up 120s then start to report its status
|
||||
// at the fix rate of 15s
|
||||
@Scheduled(initialDelay = ReportInitDelay, fixedRate = ReportFixedRate)
|
||||
/*@Scheduled(initialDelay = ReportInitDelay, fixedRate = ReportFixedRate)*/
|
||||
public void sendAgentStatusToRedis() {
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user