fix():解决报错

version-2():解决迭代器报空异常
master
Saisai Liu 2024-06-02 22:50:11 +08:00
parent c96848e9bb
commit 50b8f4aa5e
11 changed files with 246 additions and 81 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
// ApifoxModel.java
package com.mobai.domain;
package com.mobai.domain.flux;
@lombok.Data
public class ApifoxModel {

View File

@ -0,0 +1,17 @@
package com.mobai.domain.flux;
/**
* cpu使
*/
@lombok.Data
public class CPUInfo {
/**
* cpu使
*/
private String processCpuUsage;
/**
* cpu使
*/
private String systemCpuUsage;
}

View File

@ -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"

View File

@ -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

View File

@ -1,4 +1,4 @@
package com.mobai.domain;
package com.mobai.domain.flux;
/**
*

View File

@ -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;
}

View File

@ -0,0 +1,11 @@
package com.mobai.domain.flux;
/**
* MQTT
*/
@lombok.Data
public class MqttInfo {
private RunTimes runtimes;
private Events events;
}

View File

@ -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
}

View File

@ -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));
}