增加流量统计带宽统计
This commit is contained in:
@@ -63,35 +63,41 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Random r = new Random();
|
||||
Double rejectNum=r.nextDouble()*100+61351;
|
||||
Double dropConnNum=r.nextDouble()*100+54271;
|
||||
Double monitorNum=r.nextDouble()*100+54271;
|
||||
Double loopConnNum=r.nextDouble()*100+54271;
|
||||
Double rejectNum=0d;
|
||||
Double dropConnNum=0d;
|
||||
Double monitorNum=0d;
|
||||
Double loopConnNum=0d;
|
||||
Double inoctetsNum=0d;
|
||||
Double outoctetsNum=0d;
|
||||
Double bandwidth=0d;
|
||||
if(list!=null&&list.size()>0){
|
||||
Map map = (Map) list.get(0);
|
||||
rejectNum = (Double) map.get("rejectNum") ;
|
||||
monitorNum = (Double) map.get("monitorNum");
|
||||
dropConnNum = (Double) map.get("dropConnNum");
|
||||
loopConnNum = (Double) map.get("loopConnNum");
|
||||
inoctetsNum = (Double) map.get("inoctets");
|
||||
outoctetsNum = (Double) map.get("outoctets");
|
||||
//单位换算 byte->bit/s
|
||||
inoctetsNum=(inoctetsNum*8)/(5*60*60);
|
||||
outoctetsNum=(outoctetsNum*8)/(5*60*60);
|
||||
|
||||
}
|
||||
int newUniConn=r.nextInt(7666)+815036;
|
||||
int liveConnNum=r.nextInt(852)+23621;
|
||||
int bandwidth=r.nextInt(2567)+62150;
|
||||
int c2sNum=r.nextInt(100);
|
||||
bandwidth=inoctetsNum+outoctetsNum;
|
||||
m.put("rejectNum", rejectNum);
|
||||
m.put("monitorNum", monitorNum);
|
||||
m.put("loopConnNum", loopConnNum);
|
||||
m.put("dropConnNum", dropConnNum);
|
||||
m.put("newUniConn", newUniConn);
|
||||
m.put("liveConnNum", liveConnNum);
|
||||
m.put("c2sNum", c2sNum);
|
||||
m.put("bandwidth", bandwidth);
|
||||
|
||||
logger.info("活跃IP数据"+fromJsonList);
|
||||
m.put("bandwidth", bandwidth);
|
||||
m.put("inoctetsNum", inoctetsNum);
|
||||
m.put("outoctetsNum", outoctetsNum);
|
||||
|
||||
logger.info("统计流量信息数据"+fromJsonList);
|
||||
return m;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP错误"+e);
|
||||
logger.error("统计流量信息数据错误"+e);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user