parent
c96848e9bb
commit
50b8f4aa5e
|
@ -1,25 +0,0 @@
|
|||
package com.mobai.domain;
|
||||
|
||||
@lombok.Data
|
||||
public class CPUInfo {
|
||||
/**
|
||||
* CPU核数
|
||||
*/
|
||||
private long cpuNum;
|
||||
/**
|
||||
* 内核态使用率
|
||||
*/
|
||||
private String cSys;
|
||||
/**
|
||||
* 空闲率
|
||||
*/
|
||||
private String idle;
|
||||
/**
|
||||
* I/O等待
|
||||
*/
|
||||
private String iowait;
|
||||
/**
|
||||
* 用户态使用率
|
||||
*/
|
||||
private String user;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package com.mobai.domain;
|
||||
|
||||
/**
|
||||
* MQTT事件信息
|
||||
*/
|
||||
@lombok.Data
|
||||
public class MqttInfo {
|
||||
/**
|
||||
* 关闭事件数量
|
||||
*/
|
||||
private long closeEventSize;
|
||||
/**
|
||||
* 连接事件数量
|
||||
*/
|
||||
private long connectEventSize;
|
||||
/**
|
||||
* 链接总数
|
||||
*/
|
||||
private long connectSize;
|
||||
/**
|
||||
* 断开链接数量
|
||||
*/
|
||||
private long disconnectEventSize;
|
||||
/**
|
||||
* 推送数量
|
||||
*/
|
||||
private long publishEventSize;
|
||||
/**
|
||||
* 发布重试事件数量
|
||||
*/
|
||||
private long publishRetryEventSize;
|
||||
/**
|
||||
* 保留消息数量
|
||||
*/
|
||||
private long retainSize;
|
||||
/**
|
||||
* 订阅事件数量
|
||||
*/
|
||||
private long subscribeEventSize;
|
||||
/**
|
||||
* 订阅数量
|
||||
*/
|
||||
private long subscribeSize;
|
||||
/**
|
||||
* 主题数量
|
||||
*/
|
||||
private long topicSize;
|
||||
/**
|
||||
* 取消订阅数量
|
||||
*/
|
||||
private long unSubscribeEventSize;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// ApifoxModel.java
|
||||
|
||||
package com.mobai.domain;
|
||||
package com.mobai.domain.flux;
|
||||
|
||||
@lombok.Data
|
||||
public class ApifoxModel {
|
|
@ -0,0 +1,17 @@
|
|||
package com.mobai.domain.flux;
|
||||
|
||||
/**
|
||||
* cpu使用率
|
||||
*/
|
||||
@lombok.Data
|
||||
public class CPUInfo {
|
||||
/**
|
||||
* 进程cpu使用率
|
||||
*/
|
||||
private String processCpuUsage;
|
||||
|
||||
/**
|
||||
* 系统cpu使用率
|
||||
*/
|
||||
private String systemCpuUsage;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.mobai.domain.flux;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* mqtt 结束指针
|
||||
*
|
||||
* @ClassName Endpoints
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/6/2 15:16
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Endpoints {
|
||||
|
||||
/**
|
||||
* mqtt 地址
|
||||
*/
|
||||
private String mqtt;
|
||||
|
||||
/**
|
||||
* http访问地址
|
||||
*/
|
||||
private String http;
|
||||
|
||||
/**
|
||||
* websocket
|
||||
*/
|
||||
private String ws;
|
||||
|
||||
}
|
||||
// "mqtt":"mqtt://127.0.0.1:1883",
|
||||
// "http":"http://127.0.0.1:8080",
|
||||
// "ws":"ws://127.0.0.1:8883/mqtt"
|
|
@ -0,0 +1,70 @@
|
|||
package com.mobai.domain.flux;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName Events
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/6/2 15:28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Events {
|
||||
private Integer mqttConnectEvent;
|
||||
private Integer mqttCloseEvent;
|
||||
private Integer mqttDisconnectEvent;
|
||||
private Integer mqttPublishDropEvent;
|
||||
private Integer mqttPublishUnsubscribeDropEvent;
|
||||
private Integer mqttSubscribeEvent;
|
||||
private Integer mqttUnsubscribeEvent;
|
||||
private Integer mqttPublishQos0Event;
|
||||
private Integer mqttPublishQos1Event;
|
||||
private Integer mqttPublishQos2Event;
|
||||
private Integer mqttWriteQos0Event;
|
||||
private Integer mqttWriteQos1Event;
|
||||
private Integer mqttWriteQos2Event;
|
||||
private Integer mqttRewriteQos1Event;
|
||||
private Integer mqttRewriteQos2Event;
|
||||
private Integer mqttWriteDropEvent;
|
||||
private Integer authSuccessEvent;
|
||||
private Integer authFailedEvent;
|
||||
private Integer bridgeSuccessEvent;
|
||||
private Integer bridgeErrorEvent;
|
||||
private Integer bridgeDropEvent;
|
||||
private Integer eventbusSendSuccessEvent;
|
||||
private Integer eventbusSendErrorEvent;
|
||||
private Integer eventbusReceiveEvent;
|
||||
private Integer eventbusDiscardEvent;
|
||||
|
||||
}
|
||||
//"mqtt.connect.event": 11,
|
||||
//"mqtt.close.event": 9,
|
||||
//"mqtt.disconnect.event": 3,
|
||||
//"mqtt.publish.drop.event": 27,
|
||||
//"mqtt.publish.unsubscribe.drop.event": 27,
|
||||
//"mqtt.subscribe.event": 24,
|
||||
//"mqtt.unsubscribe.event": 1,
|
||||
//"mqtt.publish.qos0.event": 159,
|
||||
//"mqtt.publish.qos1.event": 0,
|
||||
//"mqtt.publish.qos2.event": 0,
|
||||
//"mqtt.write.qos0.event": 133,
|
||||
//"mqtt.write.qos1.event": 0,
|
||||
//"mqtt.write.qos2.event": 0,
|
||||
//"mqtt.rewrite.qos1.event": 0,
|
||||
//"mqtt.rewrite.qos2.event": 0,
|
||||
//"mqtt.write.drop.event": 0,
|
||||
//"auth.success.event": 0,
|
||||
//"auth.failed.event": 0,
|
||||
//"bridge.success.event": 0,
|
||||
//"bridge.error.event": 0,
|
||||
//"bridge.drop.event": 0,
|
||||
//"eventbus.send.success.event": 0,
|
||||
//"eventbus.send.error.event": 0,
|
||||
//"eventbus.receive.event": 0,
|
||||
//"eventbus.discard.event": 0
|
|
@ -1,4 +1,4 @@
|
|||
package com.mobai.domain;
|
||||
package com.mobai.domain.flux;
|
||||
|
||||
/**
|
||||
* 节点状态
|
|
@ -1,4 +1,4 @@
|
|||
package com.mobai.domain;
|
||||
package com.mobai.domain.flux;
|
||||
|
||||
/**
|
||||
* JVM使用信息
|
||||
|
@ -53,4 +53,18 @@ public class JVMInfo {
|
|||
* 线程数量
|
||||
*/
|
||||
private long threadCount;
|
||||
|
||||
/**
|
||||
* os
|
||||
*/
|
||||
private String osArch;
|
||||
/**
|
||||
* 系统名
|
||||
*/
|
||||
private String osName;
|
||||
|
||||
/**
|
||||
* cpu数量
|
||||
*/
|
||||
private String cpuCount;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.mobai.domain.flux;
|
||||
|
||||
/**
|
||||
* MQTT事件信息
|
||||
*/
|
||||
@lombok.Data
|
||||
public class MqttInfo {
|
||||
|
||||
private RunTimes runtimes;
|
||||
private Events events;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package com.mobai.domain.flux;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 运行时数据
|
||||
* @ClassName RunTimes
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/6/2 15:22
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RunTimes {
|
||||
|
||||
/**
|
||||
* mqtt 连接数量
|
||||
*/
|
||||
private Integer mqttConnect;
|
||||
|
||||
/**
|
||||
* 缓存大小
|
||||
*/
|
||||
private Integer retainSize;
|
||||
/**
|
||||
* 主题个数
|
||||
*/
|
||||
private Integer topicSize;
|
||||
|
||||
/**
|
||||
* 脚本数量
|
||||
*/
|
||||
private Integer aclCount;
|
||||
|
||||
/**
|
||||
* 脚本数量
|
||||
*/
|
||||
private Integer scriptCount;
|
||||
/**
|
||||
* 代理订阅数量
|
||||
*/
|
||||
private Integer proxySubCount;
|
||||
/**
|
||||
* 消费者数量
|
||||
*/
|
||||
private Integer commandConsumerCount;
|
||||
/**
|
||||
* mqtt 订阅数量
|
||||
*/
|
||||
private Integer mqttSubscribeQos0;
|
||||
/**
|
||||
* 订阅数量
|
||||
*/
|
||||
private Integer mqttSubscribeQos1;
|
||||
/**
|
||||
* 订阅数量
|
||||
*/
|
||||
private Integer mqttSubscribeQos2;
|
||||
/**
|
||||
* 规则引擎数量
|
||||
*/
|
||||
private Integer ruleCount;
|
||||
/**
|
||||
* 桥接数量
|
||||
*/
|
||||
private Integer bridgeOver;
|
||||
|
||||
|
||||
// "mqtt.connect": 2,
|
||||
// "retain.size": 0,
|
||||
// "topic.size": 3,
|
||||
// "acl.count": 0,
|
||||
// "script.count": 0,
|
||||
// "proxySub.count": 0,
|
||||
// "command.consumer.count": 0,
|
||||
// "mqtt.subscribe.qos0": 3,
|
||||
// "mqtt.subscribe.qos1": 0,
|
||||
// "mqtt.subscribe.qos2": 0,
|
||||
// "rule.count": 0,
|
||||
// "bridge.over": 0
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.mobai.service.impl;
|
|||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.mobai.domain.*;
|
||||
import com.mobai.domain.flux.ApifoxModel;
|
||||
import com.mobai.service.FluxGetInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -42,7 +43,7 @@ public class FluxGetInfoServiceImpl implements FluxGetInfoService {
|
|||
public Result getInfo(String ip) {
|
||||
String url = null;
|
||||
if (ip == null) {
|
||||
url = "http://39.98.50.223:8080/public/";
|
||||
url = "http://39.98.69.92:8080/public/";
|
||||
} else {
|
||||
url = "http://" + ip + ":8080/public/";
|
||||
}
|
||||
|
@ -55,10 +56,12 @@ public class FluxGetInfoServiceImpl implements FluxGetInfoService {
|
|||
//封装请求头
|
||||
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<>(headers);
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(url + "cluster", HttpMethod.GET, formEntity, String.class);
|
||||
System.out.println(exchange);
|
||||
// System.out.println(exchange);
|
||||
// System.out.println(exchange.getBody());
|
||||
List<ApifoxModel> apifoxModel = JSON.parseArray(exchange.getBody(), ApifoxModel.class);
|
||||
// get 获取具体所有信息
|
||||
log.info(apifoxModel);
|
||||
|
||||
return Result.success(apifoxModel.get(0));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue