交换机采集数据优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.tongran.agent.client.service.impl;
|
package com.tongran.agent.client.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.tongran.agent.client.core.config.GlobalConfig;
|
import com.tongran.agent.client.core.config.GlobalConfig;
|
||||||
import com.tongran.agent.client.core.vo.SwitchBoardVO;
|
import com.tongran.agent.client.core.vo.SwitchBoardVO;
|
||||||
@@ -433,6 +434,7 @@ public class SwitchBoardServiceImpl implements SwitchBoardService {
|
|||||||
if(ifOIDs == null || ifOIDs.length == 0){
|
if(ifOIDs == null || ifOIDs.length == 0){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
for (int i = 1; i <= ifNumber; i++) {
|
for (int i = 1; i <= ifNumber; i++) {
|
||||||
pdu = new PDU();
|
pdu = new PDU();
|
||||||
for (String baseOID : ifOIDs) {
|
for (String baseOID : ifOIDs) {
|
||||||
@@ -459,11 +461,13 @@ public class SwitchBoardServiceImpl implements SwitchBoardService {
|
|||||||
VariableBinding[] vbs = event.getResponse().getVariableBindings().toArray(new VariableBinding[0]);
|
VariableBinding[] vbs = event.getResponse().getVariableBindings().toArray(new VariableBinding[0]);
|
||||||
for (int m = 0; m < params.length; m++) {
|
for (int m = 0; m < params.length; m++) {
|
||||||
AssertLog.info("参数名:{},值={}", params[m],vbs[m]);
|
AssertLog.info("参数名:{},值={}", params[m],vbs[m]);
|
||||||
json.put(params[m],vbs[m].getVariable().toString());
|
JSONObject temp = new JSONObject();
|
||||||
|
temp.put(params[m],vbs[m].getVariable().toString());
|
||||||
|
list.add(temp.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return json.toString();
|
return JSON.toJSONString(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user