交换机采集信息优化
This commit is contained in:
@@ -5,6 +5,7 @@ import com.tongran.agent.client.core.config.GlobalConfig;
|
||||
import com.tongran.agent.client.core.vo.SwitchBoardVO;
|
||||
import com.tongran.agent.client.service.SwitchBoardService;
|
||||
import com.tongran.agent.client.utils.AssertLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.snmp4j.*;
|
||||
import org.snmp4j.event.ResponseEvent;
|
||||
import org.snmp4j.mp.SnmpConstants;
|
||||
@@ -394,6 +395,29 @@ public class SwitchBoardServiceImpl implements SwitchBoardService {
|
||||
}
|
||||
String[] ifOIDs = oidParams.keySet().toArray(new String[0]);
|
||||
String[] params = oidParams.values().toArray(new String[0]);
|
||||
if(!StringUtils.equals(type,"switchNetCollect") && !StringUtils.equals(type,"switchModuleCollect")
|
||||
&& !StringUtils.equals(type,"switchMpuCollect") && !StringUtils.equals(type,"switchPwrCollect")
|
||||
&& !StringUtils.equals(type,"switchFanCollect")){
|
||||
String os = "";
|
||||
String ps = "";
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
if(type.contains(params[i])){
|
||||
if(StringUtils.isBlank(ps)){
|
||||
ps += params[i];
|
||||
os += ifOIDs[i];
|
||||
}else {
|
||||
ps += "," + params[i];
|
||||
os += "," + ifOIDs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
Arrays.fill(ifOIDs, null);
|
||||
Arrays.fill(params, null);
|
||||
ifOIDs = os.split(",");
|
||||
params = ps.split(",");
|
||||
}
|
||||
|
||||
|
||||
// 获取每个接口的信息
|
||||
// String[] ifOIDs = {
|
||||
// "1.3.6.1.2.1.2.2.1.2", // ifDescr
|
||||
|
||||
Reference in New Issue
Block a user