...
|
...
|
@@ -15,10 +15,16 @@ import com.monitor.mysql.mapper.RabbitAlertMapper; |
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import sun.security.util.Length;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ArrayBlockingQueue;
|
|
|
import java.util.concurrent.Callable;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
import static com.monitor.middleware.rabbitmq.constant.InterVar.queueLastMap;
|
|
|
|
|
|
/**
|
|
|
* Created by yoho on 2016/6/21.
|
...
|
...
|
@@ -120,7 +126,7 @@ public class QueueViewJob implements Callable { |
|
|
|
|
|
queueInfo.setAlert_high(alert);
|
|
|
|
|
|
if (0 < alert && queueInfo.getMessages() > alert) {
|
|
|
if (0 < alert && queueInfo.getMessages() > alert && checkLastMore(moId, queueInfo.getName(), queueInfo.getMessages())) {
|
|
|
//alert
|
|
|
String msg = buildAlarmMsg(queueInfo);
|
|
|
|
...
|
...
|
@@ -209,4 +215,27 @@ public class QueueViewJob implements Callable { |
|
|
}
|
|
|
|
|
|
|
|
|
//若比上次高,则告警
|
|
|
private boolean checkLastMore(String moId, String queueName, int queueLength) {
|
|
|
|
|
|
boolean result = false;
|
|
|
|
|
|
String checKey = moId + "|" + queueName;
|
|
|
|
|
|
if (!queueLastMap.containsKey(checKey)) {
|
|
|
|
|
|
result = true;
|
|
|
} else {
|
|
|
if (queueLength > queueLastMap.get(checKey)) {
|
|
|
|
|
|
result = true;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
queueLastMap.put(checKey, queueLength);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|