mvn clean deploy '-Dmaven.test.skip=true'
https://github.com/apache/rocketmq-externals/tree/master/rocketmq-console
参考:https://blog.csdn.net/luanlouis/article/details/88078657
@Scheduled(cron = "0 */1 * * * ?")
public void scanProblemConsumeGroup() {
System.out.println("每1分钟监控一次");
for (Map.Entry<String, ConsumerMonitorConfig> configEntry : monitorService.queryConsumerMonitorConfig().entrySet()) {
GroupConsumeInfo consumeInfo = consumerService.queryGroup(configEntry.getKey());
if (consumeInfo.getCount() < configEntry.getValue().getMinCount() || consumeInfo.getDiffTotal() > configEntry.getValue().getMaxDiffTotal()) {
String msg = "消息堆积详情"+
"\ngroup→"+consumeInfo.getGroup()+
"\ncount→"+consumeInfo.getCount()+
"\nmessageModel→"+consumeInfo.getMessageModel()+
"\nconsumeTps→"+consumeInfo.getConsumeTps()+
"\ndiffTotal→"+consumeInfo.getDiffTotal();
dingDingSendMsg.send(msg);
}
}
}
cd project
mvn clean package
cd target
java -jar rocketmq-console-alarm-1.0.3.jar --server.port=6789 --rocketmq.config.namesrvAddr=192.168.1.10:9876 --dingding.token=***12a51a37466df312f420d4157a
0648effe59bcd725522300edae853401f4f --dingding.phones=13121939122
- server.port:指定端口号
- rocketmq.config.namesrvAddr:指定rocketmq地址,多个使用分号
;
分隔 - dingding.token:钉钉报警机器人token值
- dingding.phones:@人的手机号,所有的话使用all,多个人的话使用逗号
,
分隔
minCount 最少需要几个提供者 maxDiffTotal 消息堆积量