From ca891f367c5b23ea841695c50ddbb7f08ae23292 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 24 十月 2022 15:20:35 +0800
Subject: [PATCH] 首页改造完成,待添加系统信息
---
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java | 7
web_src/src/components/console.vue | 57 ++
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java | 6
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java | 6
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java | 7
web_src/src/components/console/ConsoleResource.vue | 86 ++++
web_src/src/components/console/ConsoleMEM.vue | 16
src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java | 22 +
src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java | 41 ++
web_src/src/components/console/ConsoleDisk.vue | 81 ++++
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 5
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 150 ++++++--
web_src/src/layout/index.vue | 3
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java | 12
src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java | 3
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java | 16
web_src/src/components/console/ConsoleCPU.vue | 20
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java | 6
src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java | 95 +++++
src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java | 8
src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java | 50 ++
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java | 8
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java | 56 ++
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java | 6
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java | 48 ++
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java | 8
/dev/null | 51 --
src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java | 2
src/main/java/com/genersoft/iot/vmp/common/SystemAllInfo.java | 20 +
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java | 4
web_src/src/components/console/ConsoleNet.vue | 32 +
web_src/src/layout/UiHeader.vue | 2
web_src/src/components/console/ConsoleNodeLoad.vue | 63 +++
web_src/src/components/console/ConsoleMediaServer.vue | 13
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java | 6
src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java | 7
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 5
37 files changed, 882 insertions(+), 146 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/common/SystemAllInfo.java b/src/main/java/com/genersoft/iot/vmp/common/SystemAllInfo.java
index eb6a37d..48485da 100644
--- a/src/main/java/com/genersoft/iot/vmp/common/SystemAllInfo.java
+++ b/src/main/java/com/genersoft/iot/vmp/common/SystemAllInfo.java
@@ -8,6 +8,10 @@
private List<Object> mem;
private List<Object> net;
+ private long netTotal;
+
+ private Object disk;
+
public List<Object> getCpu() {
return cpu;
}
@@ -31,4 +35,20 @@
public void setNet(List<Object> net) {
this.net = net;
}
+
+ public Object getDisk() {
+ return disk;
+ }
+
+ public void setDisk(Object disk) {
+ this.disk = disk;
+ }
+
+ public long getNetTotal() {
+ return netTotal;
+ }
+
+ public void setNetTotal(long netTotal) {
+ this.netTotal = netTotal;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/common/SystemInfoDto.java b/src/main/java/com/genersoft/iot/vmp/common/SystemInfoDto.java
deleted file mode 100644
index 81a93ac..0000000
--- a/src/main/java/com/genersoft/iot/vmp/common/SystemInfoDto.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.genersoft.iot.vmp.common;
-
-public class SystemInfoDto<T> {
- private String time;
- private T data;
-
- public String getTime() {
- return time;
- }
-
- public void setTime(String time) {
- this.time = time;
- }
-
- public T getData() {
- return data;
- }
-
- public void setData(T data) {
- this.data = data;
- }
-}
diff --git a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
index 6d52308..47e51ba 100644
--- a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
+++ b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
@@ -27,11 +27,9 @@
public static final String KEEPLIVEKEY_PREFIX = "VMP_KEEPALIVE_";
- // 姝ゅ澶氫簡涓�涓猒锛屾殏涓嶄慨鏀�
+ // TODO 姝ゅ澶氫簡涓�涓猒锛屾殏涓嶄慨鏀�
public static final String PLAYER_PREFIX = "VMP_PLAYER_";
public static final String PLAY_BLACK_PREFIX = "VMP_PLAYBACK_";
- public static final String PLAY_INFO_PREFIX = "VMP_PLAY_INFO_";
-
public static final String DOWNLOAD_PREFIX = "VMP_DOWNLOAD_";
public static final String PLATFORM_KEEPALIVE_PREFIX = "VMP_PLATFORM_KEEPALIVE_";
@@ -70,6 +68,8 @@
public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
+ public static final String SYSTEM_INFO_DISK_PREFIX = "VMP_SYSTEM_INFO_DISK_";
+
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java b/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java
index 5a84e25..9bc8626 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java
@@ -9,6 +9,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+import java.util.List;
import java.util.Map;
/**
@@ -31,6 +32,8 @@
redisCatchStorage.addMemInfo(memInfo);
Map<String, Double> networkInterfaces = SystemInfoUtils.getNetworkInterfaces();
redisCatchStorage.addNetInfo(networkInterfaces);
+ List<Map<String, Object>> diskInfo =SystemInfoUtils.getDiskInfo();
+ redisCatchStorage.addDiskInfo(diskInfo);
} catch (InterruptedException e) {
logger.error("[鑾峰彇绯荤粺淇℃伅澶辫触] {}", e.getMessage());
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipDeviceRunner.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipDeviceRunner.java
deleted file mode 100644
index 91d8c3d..0000000
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipDeviceRunner.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.genersoft.iot.vmp.gb28181.task;
-
-import com.genersoft.iot.vmp.conf.UserSetting;
-import com.genersoft.iot.vmp.gb28181.bean.Device;
-import com.genersoft.iot.vmp.service.IDeviceService;
-import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
-import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * 绯荤粺鍚姩鏃舵帶鍒惰澶�
- * @author lin
- */
-@Component
-@Order(value=4)
-public class SipDeviceRunner implements CommandLineRunner {
-
- @Autowired
- private IVideoManagerStorage storager;
-
- @Autowired
- private IRedisCatchStorage redisCatchStorage;
-
- @Autowired
- private UserSetting userSetting;
-
- @Autowired
- private IDeviceService deviceService;
-
- @Override
- public void run(String... args) throws Exception {
- List<Device> deviceList = deviceService.getAllOnlineDevice();
-
- for (Device device : deviceList) {
- if (deviceService.expire(device)){
- deviceService.offline(device.getDeviceId());
- }else {
- deviceService.online(device);
- }
- }
- // 閲嶇疆cseq璁℃暟
- redisCatchStorage.resetAllCSEQ();
- }
-}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java
new file mode 100644
index 0000000..e04bad9
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java
@@ -0,0 +1,95 @@
+package com.genersoft.iot.vmp.gb28181.task;
+
+import com.alibaba.fastjson.JSONObject;
+import com.genersoft.iot.vmp.conf.UserSetting;
+import com.genersoft.iot.vmp.gb28181.bean.Device;
+import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
+import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
+import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
+import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
+import com.genersoft.iot.vmp.service.IDeviceService;
+import com.genersoft.iot.vmp.service.IMediaServerService;
+import com.genersoft.iot.vmp.service.IPlatformService;
+import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
+import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 绯荤粺鍚姩鏃舵帶鍒惰澶�
+ * @author lin
+ */
+@Component
+@Order(value=4)
+public class SipRunner implements CommandLineRunner {
+
+ @Autowired
+ private IVideoManagerStorage storager;
+
+ @Autowired
+ private IRedisCatchStorage redisCatchStorage;
+
+ @Autowired
+ private UserSetting userSetting;
+
+ @Autowired
+ private IDeviceService deviceService;
+
+ @Autowired
+ private ZLMRESTfulUtils zlmresTfulUtils;
+
+ @Autowired
+ private IMediaServerService mediaServerService;
+
+ @Autowired
+ private IPlatformService platformService;
+
+ @Autowired
+ private ISIPCommanderForPlatform commanderForPlatform;
+
+ @Override
+ public void run(String... args) throws Exception {
+ List<Device> deviceList = deviceService.getAllOnlineDevice();
+
+ for (Device device : deviceList) {
+ if (deviceService.expire(device)){
+ deviceService.offline(device.getDeviceId());
+ }else {
+ deviceService.online(device);
+ }
+ }
+ // 閲嶇疆cseq璁℃暟
+ redisCatchStorage.resetAllCSEQ();
+ // 娓呯悊redis
+ // 鏌ユ壘鍥芥爣鎺ㄦ祦
+ List<SendRtpItem> sendRtpItems = redisCatchStorage.queryAllSendRTPServer();
+ if (sendRtpItems.size() > 0) {
+ for (SendRtpItem sendRtpItem : sendRtpItems) {
+ MediaServerItem mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId());
+ redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(),sendRtpItem.getChannelId(), sendRtpItem.getCallId(),sendRtpItem.getStreamId());
+ if (mediaServerItem != null) {
+ Map<String, Object> param = new HashMap<>();
+ param.put("vhost","__defaultVhost__");
+ param.put("app",sendRtpItem.getApp());
+ param.put("stream",sendRtpItem.getStreamId());
+ param.put("ssrc",sendRtpItem.getSsrc());
+ JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param);
+ if (jsonObject != null && jsonObject.getInteger("code") == 0) {
+ ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
+ if (platform != null) {
+ commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java b/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
index 9629e3a..3f58735 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
@@ -2,6 +2,7 @@
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import java.util.List;
@@ -32,4 +33,9 @@
*/
int updateChannels(String deviceId, List<DeviceChannel> channels);
+ /**
+ * 鑾峰彇缁熻淇℃伅
+ * @return
+ */
+ ResourceBaceInfo getOverview();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java b/src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
index 24051b9..b87c9a7 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
@@ -4,6 +4,7 @@
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import java.util.List;
@@ -155,4 +156,11 @@
* @return
*/
boolean delete(String deviceId);
+
+ /**
+ * 鑾峰彇缁熻淇℃伅
+ * @return
+ */
+ ResourceBaceInfo getOverview();
+
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java b/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
index 0ecc717..dd08101 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
@@ -4,10 +4,12 @@
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
+import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import java.util.List;
+import java.util.Map;
/**
* 濯掍綋鏈嶅姟鑺傜偣
@@ -87,4 +89,10 @@
void updateMediaServerKeepalive(String mediaServerId, JSONObject data);
boolean checkRtpServer(MediaServerItem mediaServerItem, String rtp, String stream);
+
+ /**
+ * 鑾峰彇璐熻浇淇℃伅
+ * @return
+ */
+ MediaServerLoad getLoad(MediaServerItem mediaServerItem);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java
index 1395a52..a2678b8 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java
@@ -4,6 +4,7 @@
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import com.github.pagehelper.PageInfo;
public interface IStreamProxyService {
@@ -102,4 +103,11 @@
* 鏇存柊浠g悊娴�
*/
boolean updateStreamProxy(StreamProxyItem streamProxyItem);
+
+ /**
+ * 鑾峰彇缁熻淇℃伅
+ * @return
+ */
+ ResourceBaceInfo getOverview();
+
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
index 5dbba92..4bccc3f 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
@@ -6,6 +6,7 @@
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
import com.github.pagehelper.PageInfo;
@@ -106,4 +107,10 @@
* @return
*/
List<String> getAllAppAndStream();
+
+ /**
+ * 鑾峰彇缁熻淇℃伅
+ * @return
+ */
+ ResourceBaceInfo getOverview();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java b/src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java
new file mode 100644
index 0000000..cb30f67
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java
@@ -0,0 +1,50 @@
+package com.genersoft.iot.vmp.service.bean;
+
+public class MediaServerLoad {
+
+ private String id;
+ private int push;
+ private int proxy;
+ private int gbReceive;
+ private int gbSend;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public int getPush() {
+ return push;
+ }
+
+ public void setPush(int push) {
+ this.push = push;
+ }
+
+ public int getProxy() {
+ return proxy;
+ }
+
+ public void setProxy(int proxy) {
+ this.proxy = proxy;
+ }
+
+ public int getGbReceive() {
+ return gbReceive;
+ }
+
+ public void setGbReceive(int gbReceive) {
+ this.gbReceive = gbReceive;
+ }
+
+ public int getGbSend() {
+ return gbSend;
+ }
+
+ public void setGbSend(int gbSend) {
+ this.gbSend = gbSend;
+ }
+}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
index 99ad3de..41b55dd 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
@@ -9,6 +9,7 @@
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -162,4 +163,9 @@
}
return addChannels.size() + updateChannels.size();
}
+
+ @Override
+ public ResourceBaceInfo getOverview() {
+ return channelMapper.getOverview();
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
index 23a342b..16c9803 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -19,6 +19,7 @@
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -620,4 +621,9 @@
}
return result;
}
+
+ @Override
+ public ResourceBaceInfo getOverview() {
+ return deviceMapper.getOverview();
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
index 7c5b149..90a73b3 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -10,6 +10,8 @@
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
+import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
+import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,6 +91,9 @@
@Autowired
private DynamicTask dynamicTask;
+
+ @Autowired
+ private IRedisCatchStorage redisCatchStorage;
/**
* 鍒濆鍖�
@@ -691,4 +696,15 @@
}
return false;
}
+
+ @Override
+ public MediaServerLoad getLoad(MediaServerItem mediaServerItem) {
+ MediaServerLoad result = new MediaServerLoad();
+ result.setId(mediaServerItem.getId());
+ result.setPush(redisCatchStorage.getPushStreamCount(mediaServerItem.getId()));
+ result.setProxy(redisCatchStorage.getProxyStreamCount(mediaServerItem.getId()));
+ result.setGbReceive(redisCatchStorage.getGbReceiveCount(mediaServerItem.getId()));
+ result.setGbSend(redisCatchStorage.getGbSendCount(mediaServerItem.getId()));
+ return result;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
index f54147e..6798b48 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
@@ -26,6 +26,7 @@
import com.genersoft.iot.vmp.service.IStreamProxyService;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
@@ -454,4 +455,9 @@
}
}
+
+ @Override
+ public ResourceBaceInfo getOverview() {
+ return streamProxyMapper.getOverview();
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
index 00980f9..1bc8b2f 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
@@ -18,6 +18,7 @@
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.*;
import com.genersoft.iot.vmp.utils.DateUtil;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
@@ -507,6 +508,12 @@
@Override
public List<String> getAllAppAndStream() {
+
return streamPushMapper.getAllAppAndStream();
}
+
+ @Override
+ public ResourceBaceInfo getOverview() {
+ return streamPushMapper.getOverview(userSetting.isUsePushingAsStatus());
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
index 77bd61c..e2f8fca 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
@@ -244,4 +244,16 @@
SystemAllInfo getSystemInfo();
+ int getPushStreamCount(String id);
+
+ int getProxyStreamCount(String id);
+
+ int getGbReceiveCount(String id);
+
+ int getGbSendCount(String id);
+
+ void addDiskInfo(List<Map<String, Object>> diskInfo);
+
+ List<SendRtpItem> queryAllSendRTPServer();
+
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index 9b2a099..ff20cef 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -3,6 +3,7 @@
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@@ -347,4 +348,8 @@
@Select("select * from device_channel where deviceId = #{deviceId}")
List<DeviceChannel> queryAllChannels(String deviceId);
+
+
+ @Select("select count(1) as total, sum(status) as online from device_channel")
+ ResourceBaceInfo getOverview();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
index 03dba38..b1210c6 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.Device;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@@ -251,4 +252,8 @@
"#{online}" +
")")
void addCustomDevice(Device device);
+
+ @Select("select count(1) as total, sum(online) as online from device")
+ ResourceBaceInfo getOverview();
+
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
index a9827ad..448a358 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@@ -75,4 +76,7 @@
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable_remove_none_reader=true AND st.mediaServerId=#{mediaServerId} order by st.createTime desc")
List<StreamProxyItem> selecAutoRemoveItemByMediaServerId(String mediaServerId);
+
+ @Select("select count(1) as total, sum(status) as online from stream_proxy")
+ ResourceBaceInfo getOverview();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
index 675a8bc..ec51f11 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -3,6 +3,7 @@
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.apache.ibatis.annotations.*;
// import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.stereotype.Repository;
@@ -171,4 +172,10 @@
@Select("SELECT CONCAT(app,stream) FROM gb_stream")
List<String> getAllAppAndStream();
+
+ @Select(value = {" <script>" +
+ " <if test='pushIngAsOnline == true'> select count(1) as total, sum(pushIng) as online from stream_push </if>" +
+ " <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from stream_push </if>" +
+ " </script>"})
+ ResourceBaceInfo getOverview(boolean pushIngAsOnline);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index 6178a3b..b82ccf9 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -4,7 +4,6 @@
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.common.SystemAllInfo;
-import com.genersoft.iot.vmp.common.SystemInfoDto;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
@@ -18,6 +17,7 @@
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
import com.genersoft.iot.vmp.utils.DateUtil;
+import com.genersoft.iot.vmp.utils.SystemInfoUtils;
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,8 +89,9 @@
*/
@Override
public boolean startPlay(StreamInfo stream) {
- return RedisUtil.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),
- stream.getStream(), stream.getDeviceID(), stream.getChannelId()),
+
+ return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),
+ stream.getMediaServerId(), stream.getStream(), stream.getDeviceID(), stream.getChannelId()),
stream);
}
@@ -104,8 +105,9 @@
if (streamInfo == null) {
return false;
}
- return RedisUtil.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
+ return RedisUtil.del(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
userSetting.getServerId(),
+ streamInfo.getMediaServerId(),
streamInfo.getStream(),
streamInfo.getDeviceID(),
streamInfo.getChannelId()));
@@ -117,17 +119,17 @@
*/
@Override
public StreamInfo queryPlay(StreamInfo streamInfo) {
- return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s",
+ return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s_%s",
VideoManagerConstants.PLAYER_PREFIX,
userSetting.getServerId(),
+ streamInfo.getMediaServerId(),
streamInfo.getStream(),
streamInfo.getDeviceID(),
streamInfo.getChannelId()));
}
@Override
public StreamInfo queryPlayByStreamId(String streamId) {
- System.out.println(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId));
- List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId));
+ List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId));
if (playLeys == null || playLeys.size() == 0) {
return null;
}
@@ -136,7 +138,7 @@
@Override
public StreamInfo queryPlayByDevice(String deviceId, String channelId) {
- List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
+ List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
userSetting.getServerId(),
deviceId,
channelId));
@@ -149,8 +151,7 @@
@Override
public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) {
Map<String, StreamInfo> streamInfos = new HashMap<>();
-// List<Object> playLeys = RedisUtil.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
- List<Object> players = RedisUtil.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId));
+ List<Object> players = RedisUtil.scan(String.format("%S_%s_*_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId));
if (players.size() == 0) {
return streamInfos;
}
@@ -165,21 +166,19 @@
@Override
public boolean startPlayback(StreamInfo stream, String callId) {
- System.out.println(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
- userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId));
- return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
- userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
+ return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
+ userSetting.getServerId(), stream.getMediaServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
}
@Override
public boolean startDownload(StreamInfo stream, String callId) {
boolean result;
if (stream.getProgress() == 1) {
- result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
- userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
+ result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
+ userSetting.getServerId(), stream.getMediaServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
}else {
- result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
- userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60);
+ result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
+ userSetting.getServerId(), stream.getMediaServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60);
}
return result;
}
@@ -203,7 +202,7 @@
if (callId == null) {
callId = "*";
}
- String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
+ String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
userSetting.getServerId(),
deviceId,
channelId,
@@ -239,7 +238,7 @@
if (callId == null) {
callId = "*";
}
- String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
+ String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
userSetting.getServerId(),
deviceId,
channelId,
@@ -272,7 +271,7 @@
if (callId == null) {
callId = "*";
}
- String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
+ String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
userSetting.getServerId(),
deviceId,
channelId,
@@ -304,7 +303,7 @@
if (callId == null) {
callId = "*";
}
- String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
+ String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
userSetting.getServerId(),
deviceId,
channelId,
@@ -369,9 +368,14 @@
@Override
public void updateSendRTPSever(SendRtpItem sendRtpItem) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_"
- + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_"
- + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId();
+
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX +
+ userSetting.getServerId() + "_"
+ + sendRtpItem.getMediaServerId() + "_"
+ + sendRtpItem.getPlatformId() + "_"
+ + sendRtpItem.getChannelId() + "_"
+ + sendRtpItem.getStreamId() + "_"
+ + sendRtpItem.getCallId();
RedisUtil.set(key, sendRtpItem);
}
@@ -389,8 +393,12 @@
if (callId == null) {
callId = "*";
}
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
- + "_" + channelId + "_" + streamId + "_" + callId;
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_"
+ + platformGbId + "_"
+ + channelId + "_"
+ + streamId + "_"
+ + callId;
List<Object> scan = RedisUtil.scan(key);
if (scan.size() > 0) {
return (SendRtpItem)RedisUtil.get((String)scan.get(0));
@@ -407,8 +415,12 @@
String platformGbId = "*";
String callId = "*";
String streamId = "*";
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
- + "_" + channelId + "_" + streamId + "_" + callId;
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_"
+ + platformGbId + "_"
+ + channelId + "_"
+ + streamId + "_"
+ + callId;
List<Object> scan = RedisUtil.scan(key);
List<SendRtpItem> result = new ArrayList<>();
for (Object o : scan) {
@@ -425,8 +437,12 @@
String platformGbId = "*";
String callId = "*";
String channelId = "*";
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
- + "_" + channelId + "_" + stream + "_" + callId;
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_"
+ + platformGbId + "_"
+ + channelId + "_"
+ + stream + "_"
+ + callId;
List<Object> scan = RedisUtil.scan(key);
List<SendRtpItem> result = new ArrayList<>();
for (Object o : scan) {
@@ -440,7 +456,9 @@
if (platformGbId == null) {
platformGbId = "*";
}
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*";
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_"
+ + platformGbId + "_*" + "_*" + "_*";
List<Object> queryResult = RedisUtil.scan(key);
List<SendRtpItem> result= new ArrayList<>();
@@ -465,8 +483,12 @@
if (callId == null) {
callId = "*";
}
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
- + "_" + channelId + "_" + streamId + "_" + callId;
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_"
+ + platformGbId + "_"
+ + channelId + "_"
+ + streamId + "_"
+ + callId;
List<Object> scan = RedisUtil.scan(key);
if (scan.size() > 0) {
for (Object keyStr : scan) {
@@ -475,7 +497,20 @@
}
}
+ @Override
+ public List<SendRtpItem> queryAllSendRTPServer() {
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*";
+ List<Object> queryResult = RedisUtil.scan(key);
+ List<SendRtpItem> result= new ArrayList<>();
+ for (Object o : queryResult) {
+ String keyItem = (String) o;
+ result.add((SendRtpItem) RedisUtil.get(keyItem));
+ }
+
+ return result;
+ }
/**
* 鏌ヨ鏌愪釜閫氶亾鏄惁瀛樺湪涓婄骇鐐规挱锛圧TP鎺ㄩ�侊級
@@ -483,7 +518,9 @@
*/
@Override
public boolean isChannelSendingRTP(String channelId) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_";
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_*_"
+ + channelId + "*_" + "*_";
List<Object> RtpStreams = RedisUtil.scan(key);
if (RtpStreams.size() > 0) {
return true;
@@ -503,7 +540,7 @@
}
}
- List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX,
+ List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_*_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX,
userSetting.getServerId(),
deviceId));
if (playBackers.size() > 0) {
@@ -569,7 +606,7 @@
if (callId == null) {
callId = "*";
}
- String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
+ String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
userSetting.getServerId(),
deviceId,
channelId,
@@ -740,14 +777,25 @@
}
@Override
+ public void addDiskInfo(List<Map<String, Object>> diskInfo) {
+
+ String key = VideoManagerConstants.SYSTEM_INFO_DISK_PREFIX + userSetting.getServerId();
+ RedisUtil.set(key, diskInfo);
+ }
+
+ @Override
public SystemAllInfo getSystemInfo() {
String cpuKey = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetting.getServerId();
String memKey = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetting.getServerId();
String netKey = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetting.getServerId();
+ String diskKey = VideoManagerConstants.SYSTEM_INFO_DISK_PREFIX + userSetting.getServerId();
SystemAllInfo systemAllInfo = new SystemAllInfo();
systemAllInfo.setCpu(RedisUtil.lGet(cpuKey, 0, -1));
systemAllInfo.setMem(RedisUtil.lGet(memKey, 0, -1));
systemAllInfo.setNet(RedisUtil.lGet(netKey, 0, -1));
+
+ systemAllInfo.setDisk(RedisUtil.get(diskKey));
+ systemAllInfo.setNetTotal(SystemInfoUtils.getNetworkTotal());
return systemAllInfo;
}
@@ -786,4 +834,32 @@
jsonObject.put(key, key);
RedisUtil.convertAndSend(key, jsonObject);
}
+
+ @Override
+ public int getPushStreamCount(String id) {
+ String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_PUSH_*_*_" + id;
+ return RedisUtil.scan(key).size();
+ }
+
+ @Override
+ public int getProxyStreamCount(String id) {
+ String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_PULL_*_*_" + id;
+ return RedisUtil.scan(key).size();
+ }
+
+ @Override
+ public int getGbReceiveCount(String id) {
+ String playKey = VideoManagerConstants.PLAYER_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*";
+ String playBackKey = VideoManagerConstants.PLAY_BLACK_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*";
+ String downloadKey = VideoManagerConstants.DOWNLOAD_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*";
+
+ return RedisUtil.scan(playKey).size() + RedisUtil.scan(playBackKey).size() + RedisUtil.scan(downloadKey).size();
+ }
+
+ @Override
+ public int getGbSendCount(String id) {
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ + userSetting.getServerId() + "_*_" + id + "_*";
+ return RedisUtil.scan(key).size();
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
index ca637dd..ed0e0fd 100644
--- a/src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
@@ -13,7 +13,7 @@
@Value("${git.branch:}")
private String branch;
- @Value("${git.commit.id:}")
+ @Value("${git.commit.id.abbrev:}")
private String gitCommitId;
@Value("${git.remote.origin.url:}")
private String gitUrl;
diff --git a/src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java b/src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
index 3af4853..d228787 100644
--- a/src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
@@ -1,14 +1,14 @@
package com.genersoft.iot.vmp.utils;
+import org.springframework.util.ObjectUtils;
import oshi.SystemInfo;
-import oshi.hardware.CentralProcessor;
-import oshi.hardware.GlobalMemory;
-import oshi.hardware.HardwareAbstractionLayer;
-import oshi.hardware.NetworkIF;
+import oshi.hardware.*;
import oshi.software.os.OperatingSystem;
import oshi.util.FormatUtil;
+import java.io.File;
import java.text.DecimalFormat;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -85,6 +85,19 @@
return map;
}
+ /**
+ * 鑾峰彇甯﹀鎬诲��
+ * @return
+ */
+ public static long getNetworkTotal() {
+ SystemInfo si = new SystemInfo();
+ HardwareAbstractionLayer hal = si.getHardware();
+ List<NetworkIF> recvNetworkIFs = hal.getNetworkIFs();
+ NetworkIF networkIF= recvNetworkIFs.get(recvNetworkIFs.size() - 1);
+
+ return networkIF.getSpeed()/1048576L/8L;
+ }
+
public static double formatUnits(long value, long prefix) {
return (double)value / (double)prefix;
}
@@ -100,4 +113,31 @@
int processCount = os.getProcessCount();
return processCount;
}
+
+ public static List<Map<String, Object>> getDiskInfo() {
+ List<Map<String, Object>> result = new ArrayList<>();
+
+ String osName = System.getProperty("os.name");
+ List<String> pathArray = new ArrayList<>();
+ if (osName.startsWith("Mac OS")) {
+ // 鑻规灉
+ pathArray.add("/");
+ } else if (osName.startsWith("Windows")) {
+ // windows
+ pathArray.add("C:");
+ } else {
+ pathArray.add("/");
+ pathArray.add("/home");
+ }
+ for (String path : pathArray) {
+ Map<String, Object> infoMap = new HashMap<>();
+ infoMap.put("path", path);
+ File partitionFile = new File(path);
+ // 鍗曚綅锛� GB
+ infoMap.put("use", (partitionFile.getTotalSpace() - partitionFile.getFreeSpace())/1024/1024/1024D);
+ infoMap.put("free", partitionFile.getFreeSpace()/1024/1024/1024D);
+ result.add(infoMap);
+ }
+ return result;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java
new file mode 100644
index 0000000..b50d97a
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java
@@ -0,0 +1,22 @@
+package com.genersoft.iot.vmp.vmanager.bean;
+
+public class ResourceBaceInfo {
+ private int total;
+ private int online;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public int getOnline() {
+ return online;
+ }
+
+ public void setOnline(int online) {
+ this.online = online;
+ }
+}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java
new file mode 100644
index 0000000..b8d7009
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java
@@ -0,0 +1,41 @@
+package com.genersoft.iot.vmp.vmanager.bean;
+
+public class ResourceInfo {
+
+ private ResourceBaceInfo device;
+ private ResourceBaceInfo channel;
+ private ResourceBaceInfo push;
+ private ResourceBaceInfo proxy;
+
+ public ResourceBaceInfo getDevice() {
+ return device;
+ }
+
+ public void setDevice(ResourceBaceInfo device) {
+ this.device = device;
+ }
+
+ public ResourceBaceInfo getChannel() {
+ return channel;
+ }
+
+ public void setChannel(ResourceBaceInfo channel) {
+ this.channel = channel;
+ }
+
+ public ResourceBaceInfo getPush() {
+ return push;
+ }
+
+ public void setPush(ResourceBaceInfo push) {
+ this.push = push;
+ }
+
+ public ResourceBaceInfo getProxy() {
+ return proxy;
+ }
+
+ public void setProxy(ResourceBaceInfo proxy) {
+ this.proxy = proxy;
+ }
+}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
index ef2d748..ed6f44d 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
@@ -12,10 +12,13 @@
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
-import com.genersoft.iot.vmp.service.IMediaServerService;
+import com.genersoft.iot.vmp.service.*;
+import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
+import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo;
import gov.nist.javax.sip.SipStackImpl;
import io.swagger.v3.oas.annotations.Operation;
@@ -30,8 +33,7 @@
import javax.sip.ListeningPoint;
import javax.sip.ObjectInUseException;
import javax.sip.SipProvider;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
@SuppressWarnings("rawtypes")
@Tag(name = "鏈嶅姟鎺у埗")
@@ -54,6 +56,20 @@
@Autowired
private UserSetting userSetting;
+
+ @Autowired
+ private IDeviceService deviceService;
+
+ @Autowired
+ private IDeviceChannelService channelService;
+
+ @Autowired
+ private IStreamPushService pushService;
+
+
+ @Autowired
+ private IStreamProxyService proxyService;
+
@Value("${server.port}")
private int serverPort;
@@ -213,6 +229,40 @@
@Operation(summary = "鑾峰彇绯荤粺淇℃伅")
public SystemAllInfo getSystemInfo() {
SystemAllInfo systemAllInfo = redisCatchStorage.getSystemInfo();
+
return systemAllInfo;
}
+
+ @GetMapping(value = "/media_server/load")
+ @ResponseBody
+ @Operation(summary = "鑾峰彇璐熻浇淇℃伅")
+ public List<MediaServerLoad> getMediaLoad() {
+ List<MediaServerLoad> result = new ArrayList<>();
+ List<MediaServerItem> allOnline = mediaServerService.getAllOnline();
+ if (allOnline.size() == 0) {
+ return result;
+ }else {
+ for (MediaServerItem mediaServerItem : allOnline) {
+ result.add(mediaServerService.getLoad(mediaServerItem));
+ }
+ }
+ return result;
+ }
+
+ @GetMapping(value = "/resource/info")
+ @ResponseBody
+ @Operation(summary = "鑾峰彇璐熻浇淇℃伅")
+ public ResourceInfo getResourceInfo() {
+ ResourceInfo result = new ResourceInfo();
+ ResourceBaceInfo deviceInfo = deviceService.getOverview();
+ result.setDevice(deviceInfo);
+ ResourceBaceInfo channelInfo = channelService.getOverview();
+ result.setChannel(channelInfo);
+ ResourceBaceInfo pushInfo = pushService.getOverview();
+ result.setPush(pushInfo);
+ ResourceBaceInfo proxyInfo = proxyService.getOverview();
+ result.setProxy(proxyInfo);
+
+ return result;
+ }
}
diff --git a/web_src/src/components/console.vue b/web_src/src/components/console.vue
index f663aaa..352989f 100644
--- a/web_src/src/components/console.vue
+++ b/web_src/src/components/console.vue
@@ -2,6 +2,10 @@
<div id="app" style="width: 100%">
<div class="page-header">
<div class="page-title">鎺у埗鍙�</div>
+ <div class="page-header-btn">
+ <el-button icon="el-icon-info" size="mini" style="margin-right: 1rem;" type="primary" @click="showInfo">骞冲彴淇℃伅
+ </el-button>
+ </div>
</div>
<el-row style="width: 100%">
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
@@ -14,7 +18,7 @@
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
<div class="control-cell" id="WorkThreadsLoad" >
<div style="width:100%; height:100%; ">
- <consoleMem ref="consoleMem"></consoleMem>
+ <consoleResource ref="consoleResource"></consoleResource>
</div>
</div>
</el-col>
@@ -28,26 +32,25 @@
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
<div class="control-cell" id="WorkThreadsLoad" >
<div style="width:100%; height:100%; ">
- <consoleCPU></consoleCPU>
+
+ <consoleMem ref="consoleMem"></consoleMem>
</div>
</div>
</el-col>
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
<div class="control-cell" id="WorkThreadsLoad" >
<div style="width:100%; height:100%; ">
- <consoleCPU></consoleCPU>
+ <consoleNodeLoad ref="consoleNodeLoad"></consoleNodeLoad>
</div>
</div>
</el-col>
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
<div class="control-cell" id="WorkThreadsLoad" >
<div style="width:100%; height:100%; ">
- <consoleCPU></consoleCPU>
+ <consoleDisk ref="consoleDisk"></consoleDisk>
</div>
</div>
</el-col>
-
-
</el-row>
</div>
</template>
@@ -57,6 +60,9 @@
import consoleCPU from './console/ConsoleCPU.vue'
import consoleMem from './console/ConsoleMEM.vue'
import consoleNet from './console/ConsoleNet.vue'
+import consoleNodeLoad from './console/ConsoleNodeLoad.vue'
+import consoleDisk from './console/ConsoleDisk.vue'
+import consoleResource from './console/ConsoleResource.vue'
import echarts from 'echarts';
@@ -67,7 +73,10 @@
uiHeader,
consoleCPU,
consoleMem,
- consoleNet
+ consoleNet,
+ consoleNodeLoad,
+ consoleDisk,
+ consoleResource,
},
data() {
return {
@@ -76,7 +85,10 @@
},
created() {
this.getSystemInfo();
+ this.getLoad();
+ this.getResourceInfo();
this.loopForSystemInfo();
+
},
destroyed() {
},
@@ -87,8 +99,10 @@
}
this.timer = setTimeout(()=>{
this.getSystemInfo();
+ this.getLoad();
this.timer = null;
this.loopForSystemInfo()
+ this.getResourceInfo()
}, 2000)
},
getSystemInfo: function (){
@@ -99,11 +113,38 @@
if (res.data.code === 0) {
this.$refs.consoleCPU.setData(res.data.data.cpu)
this.$refs.consoleMem.setData(res.data.data.mem)
- this.$refs.consoleNet.setData(res.data.data.net)
+ this.$refs.consoleNet.setData(res.data.data.net, res.data.data.netTotal)
+ this.$refs.consoleDisk.setData(res.data.data.disk)
}
}).catch( (error)=> {
});
+ },
+ getLoad: function (){
+ this.$axios({
+ method: 'get',
+ url: `/api/server/media_server/load`,
+ }).then( (res)=> {
+ if (res.data.code === 0) {
+ this.$refs.consoleNodeLoad.setData(res.data.data)
+ }
+ }).catch( (error)=> {
+ });
+ },
+ getResourceInfo: function (){
+ this.$axios({
+ method: 'get',
+ url: `/api/server/resource/info`,
+ }).then( (res)=> {
+ if (res.data.code === 0) {
+ this.$refs.consoleResource.setData(res.data.data)
+ }
+ }).catch( (error)=> {
+ });
+ },
+ showInfo: function (){
+
}
+
}
};
</script>
diff --git a/web_src/src/components/console/ConsoleCPU.vue b/web_src/src/components/console/ConsoleCPU.vue
index 0b4ecb2..5aed07e 100644
--- a/web_src/src/components/console/ConsoleCPU.vue
+++ b/web_src/src/components/console/ConsoleCPU.vue
@@ -1,6 +1,6 @@
<template>
<div id="consoleCPU" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
- <ve-line :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
+ <ve-line ref="consoleCPU" :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
</div>
</template>
@@ -59,7 +59,8 @@
trigger: 'axis',
formatter: (data)=>{
console.log(data)
- return moment(data[0].data[0]).format("HH:mm:ss") + "</br> 浣跨敤锛�" + (data[0].data[1]*100).toFixed(2) + "%";
+ return moment(data[0].data[0]).format("HH:mm:ss") + "</br> "
+ + data[0].marker + "浣跨敤锛�" + (data[0].data[1]*100).toFixed(2) + "%";
}
},
series: {
@@ -85,13 +86,16 @@
}
};
},
+ created() {
+
+
+ },
mounted() {
- // setInterval(()=>{
- // // console.log(111111)
- // for (let i = 0; i < this.chartData.rows.length; i++) {
- // this.chartData.rows[i].閿�鍞 += 1000;
- // }
- // },1000)
+ this.$nextTick(_ => {
+ setTimeout(()=>{
+ this.$refs.consoleCPU.echarts.resize()
+ }, 100)
+ })
},
destroyed() {
},
diff --git a/web_src/src/components/console/ConsoleDisk.vue b/web_src/src/components/console/ConsoleDisk.vue
new file mode 100644
index 0000000..ed69cc3
--- /dev/null
+++ b/web_src/src/components/console/ConsoleDisk.vue
@@ -0,0 +1,81 @@
+<template>
+ <div id="ConsoleNet" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
+ <ve-bar ref="ConsoleNet" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-bar>
+ </div>
+</template>
+
+<script>
+
+
+import moment from "moment/moment";
+
+export default {
+ name: 'ConsoleNet',
+ data() {
+ return {
+ chartData: {
+ columns: ['path','free','use'],
+ rows: []
+ },
+ chartSettings: {
+ stack: {
+ 'xxx': ['free', 'use']
+ },
+ labelMap: {
+ 'free': '鍓╀綑',
+ 'use': '宸蹭娇鐢�'
+ },
+ },
+ extend: {
+ title: {
+ show: true,
+ text: "纾佺洏",
+ left: "center",
+ top: 20,
+ },
+ grid: {
+ show: true,
+ right: "30px",
+ containLabel: true,
+ },
+ series: {
+ barWidth: 30
+ },
+ legend: {
+ left: "center",
+ bottom: "15px",
+ },
+ tooltip: {
+ trigger: 'axis',
+ formatter: (data)=>{
+ console.log(data)
+ let relVal = "";
+ for (let i = 0; i < data.length; i++) {
+ relVal += data[i].marker + data[i].seriesName + ":" + data[i].value.toFixed(2) + "GB"
+ if (i < data.length - 1) {
+ relVal += "</br>";
+ }
+ }
+ return relVal;
+ }
+ },
+
+ }
+ };
+ },
+ mounted() {
+ this.$nextTick(_ => {
+ setTimeout(()=>{
+ this.$refs.ConsoleNet.echarts.resize()
+ }, 100)
+ })
+ },
+ destroyed() {
+ },
+ methods: {
+ setData: function(data) {
+ this.chartData.rows = data;
+ }
+ }
+};
+</script>
diff --git a/web_src/src/components/console/ConsoleMEM.vue b/web_src/src/components/console/ConsoleMEM.vue
index beaa38c..566b469 100644
--- a/web_src/src/components/console/ConsoleMEM.vue
+++ b/web_src/src/components/console/ConsoleMEM.vue
@@ -1,6 +1,6 @@
<template>
<div id="ConsoleMEM" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
- <ve-line :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
+ <ve-line ref="ConsoleMEM" :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
</div>
</template>
@@ -59,7 +59,7 @@
trigger: 'axis',
formatter: (data)=>{
console.log(data)
- return moment(data[0].data[0]).format("HH:mm:ss") + "</br> 浣跨敤锛�" + (data[0].data[1]*100).toFixed(2) + "%";
+ return moment(data[0].data[0]).format("HH:mm:ss") + "</br>"+ data[0].marker +" 浣跨敤锛�" + (data[0].data[1]*100).toFixed(2) + "%";
}
},
series: {
@@ -86,12 +86,11 @@
};
},
mounted() {
- // setInterval(()=>{
- // // console.log(111111)
- // for (let i = 0; i < this.chartData.rows.length; i++) {
- // this.chartData.rows[i].閿�鍞 += 1000;
- // }
- // },1000)
+ this.$nextTick(_ => {
+ setTimeout(()=>{
+ this.$refs.ConsoleMEM.echarts.resize()
+ }, 100)
+ })
},
destroyed() {
},
@@ -99,7 +98,6 @@
setData: function(data) {
this.chartData .rows = data;
}
-
}
};
</script>
diff --git a/web_src/src/components/console/ConsoleMediaServer.vue b/web_src/src/components/console/ConsoleMediaServer.vue
index 810ee39..a842b50 100644
--- a/web_src/src/components/console/ConsoleMediaServer.vue
+++ b/web_src/src/components/console/ConsoleMediaServer.vue
@@ -1,6 +1,6 @@
<template>
<div id="ConsoleMediaServer" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
- <ve-histogram :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-histogram>
+ <ve-histogram ref="ConsoleMEM" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-histogram>
</div>
</template>
@@ -66,12 +66,11 @@
};
},
mounted() {
- // setInterval(()=>{
- // // console.log(111111)
- // for (let i = 0; i < this.chartData.rows.length; i++) {
- // this.chartData.rows[i].閿�鍞 += 1000;
- // }
- // },1000)
+ this.$nextTick(_ => {
+ setTimeout(()=>{
+ this.$refs.ConsoleMEM.echarts.resize()
+ }, 100)
+ })
},
destroyed() {
},
diff --git a/web_src/src/components/console/ConsoleNet.vue b/web_src/src/components/console/ConsoleNet.vue
index a6d7111..22d4f34 100644
--- a/web_src/src/components/console/ConsoleNet.vue
+++ b/web_src/src/components/console/ConsoleNet.vue
@@ -1,6 +1,6 @@
<template>
<div id="ConsoleNet" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
- <ve-line :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-line>
+ <ve-line ref="ConsoleNet" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-line>
</div>
</template>
@@ -14,7 +14,7 @@
data() {
return {
chartData: {
- columns: ['time', 'in', 'out'],
+ columns: ['time','out','in'],
rows: []
},
chartSettings: {
@@ -48,13 +48,18 @@
showMaxLabel: true,
},
},
+ yAxis: {
+ type: 'value',
+ min: 0,
+ max: 1000,
+ splitNumber: 6,
+ position: "left",
+ silent: true,
+ },
tooltip: {
trigger: 'axis',
formatter: (data)=>{
- console.log(parseFloat(data[0].data[1]).toFixed(2))
- console.log(parseFloat(data[1].data[1]).toFixed(2))
- console.log("############")
- return "涓嬭浇锛�" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps" + "</br> 涓婁紶锛�" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps";
+ return data[1].marker + "涓嬭浇锛�" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps" + "</br> "+ data[0].marker +" 涓婁紶锛�" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps";
}
},
legend: {
@@ -65,19 +70,18 @@
};
},
mounted() {
- // setInterval(()=>{
- // // console.log(111111)
- // for (let i = 0; i < this.chartData.rows.length; i++) {
- // this.chartData.rows[i].閿�鍞 += 1000;
- // }
- // },1000)
+ this.$nextTick(_ => {
+ setTimeout(()=>{
+ this.$refs.ConsoleNet.echarts.resize()
+ }, 100)
+ })
},
destroyed() {
},
methods: {
- setData: function(data) {
- console.log(data)
+ setData: function(data, total) {
this.chartData .rows = data;
+ this.extend.yAxis.max= total;
}
}
diff --git a/web_src/src/components/console/ConsoleNodeLoad.vue b/web_src/src/components/console/ConsoleNodeLoad.vue
new file mode 100644
index 0000000..0596c41
--- /dev/null
+++ b/web_src/src/components/console/ConsoleNodeLoad.vue
@@ -0,0 +1,63 @@
+<template>
+ <div id="ConsoleNodeLoad" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
+ <ve-histogram ref="consoleNodeLoad" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" :legend-visible="true"></ve-histogram>
+ </div>
+</template>
+
+<script>
+
+
+import moment from "moment/moment";
+
+export default {
+ name: 'ConsoleNodeLoad',
+ data() {
+ return {
+ chartData: {
+ columns: ['id', 'push', 'proxy', 'gbReceive', 'gbSend'],
+ rows: []
+ },
+ chartSettings: {
+ labelMap: {
+ 'push': '鐩存挱鎺ㄦ祦',
+ 'proxy': '鎷夋祦浠g悊',
+ 'gbReceive': '鍥芥爣鏀舵祦',
+ 'gbSend': '鍥芥爣鎺ㄦ祦',
+ },
+ },
+ extend: {
+ title: {
+ show: true,
+ text: "鑺傜偣璐熻浇",
+ left: "center",
+ top: 20,
+
+ },
+ legend: {
+ left: "center",
+ bottom: "15px",
+ },
+ label: {
+ show: true,
+ position: "top"
+ }
+ }
+ };
+ },
+ mounted() {
+ this.$nextTick(_ => {
+ setTimeout(()=>{
+ this.$refs.consoleNodeLoad.echarts.resize()
+ }, 100)
+ })
+ },
+ destroyed() {
+ },
+ methods: {
+ setData: function(data) {
+ this.chartData .rows = data;
+ }
+
+ }
+};
+</script>
diff --git a/web_src/src/components/console/ConsoleResource.vue b/web_src/src/components/console/ConsoleResource.vue
new file mode 100644
index 0000000..c76b270
--- /dev/null
+++ b/web_src/src/components/console/ConsoleResource.vue
@@ -0,0 +1,86 @@
+<template >
+ <div id="consoleResource" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
+ <div style="width: 50%;height: 50%; float:left; ">
+ <el-progress :width="100" :stroke-width="8" type="circle" :percentage="deviceInfo.online/deviceInfo.total*100" style="margin-top: 20px; font-size: 18px"></el-progress>
+ <div class="resourceInfo">
+ 璁惧鎬绘暟:{{deviceInfo.total}}<br/>
+ 鍦ㄧ嚎鏁�:{{deviceInfo.online}}
+ </div>
+ </div>
+ <div style="width: 50%;height: 50%; float:left; ">
+ <el-progress :width="100" :stroke-width="10" type="circle" :percentage="channelInfo.online/channelInfo.total*100" style="margin-top: 20px"></el-progress>
+ <div class="resourceInfo">
+ 閫氶亾鎬绘暟:{{channelInfo.total}}<br/>
+ 鍦ㄧ嚎鏁�:{{channelInfo.online}}
+ </div>
+ </div>
+ <div style="width: 50%;height: 50%; float:left; ">
+ <el-progress :width="100" :stroke-width="10" type="circle" :percentage="pushInfo.online/pushInfo.total*100" style="margin-top: 20px"></el-progress>
+ <div class="resourceInfo">
+ 鎺ㄦ祦鎬绘暟:{{pushInfo.total}}<br/>
+ 鍦ㄧ嚎鏁�:{{pushInfo.online}}
+ </div>
+ </div>
+ <div style="width: 50%;height: 50%; float:left; ">
+ <el-progress :width="100" :stroke-width="10" type="circle" :percentage="proxyInfo.online/proxyInfo.total*100" style="margin-top: 20px"></el-progress>
+ <div class="resourceInfo">
+ 鎷夋祦浠g悊鎬绘暟:{{proxyInfo.total}}<br/>
+ 鍦ㄧ嚎鏁�:{{proxyInfo.online}}
+ </div>
+ </div>
+ </div>
+</template>
+
+<script>
+
+export default {
+ name: 'consoleResource',
+ data() {
+ return {
+ deviceInfo: {
+ total: 0,
+ online: 0
+ },
+ channelInfo: {
+ total: 0,
+ online: 0
+ },
+ pushInfo: {
+ total: 0,
+ online: 0
+ },
+ proxyInfo: {
+ total: 0,
+ online: 0
+ },
+ };
+ },
+ created() {
+
+
+ },
+ mounted() {
+ },
+ destroyed() {
+ },
+ methods: {
+ setData: function(data) {
+ this.deviceInfo = data.device;
+ this.channelInfo = data.channel;
+ this.pushInfo = data.push;
+ this.proxyInfo = data.proxy;
+ }
+ }
+};
+</script>
+
+<style>
+.resourceInfo{
+ width: 100%;
+ text-align: center;
+ font-size: 12px
+}
+.el-progress__text {
+ font-size: 18px !important;
+}
+</style>
diff --git a/web_src/src/layout/UiHeader.vue b/web_src/src/layout/UiHeader.vue
index 42d617e..fa9be3e 100644
--- a/web_src/src/layout/UiHeader.vue
+++ b/web_src/src/layout/UiHeader.vue
@@ -4,7 +4,7 @@
<el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#001529" text-color="#fff"
active-text-color="#1890ff" mode="horizontal">
- <el-menu-item index="/control">鎺у埗鍙�</el-menu-item>
+ <el-menu-item index="/console">鎺у埗鍙�</el-menu-item>
<el-menu-item index="/live">鍒嗗睆鐩戞帶</el-menu-item>
<el-menu-item index="/deviceList">鍥芥爣璁惧</el-menu-item>
<el-menu-item index="/map">鐢靛瓙鍦板浘</el-menu-item>
diff --git a/web_src/src/layout/index.vue b/web_src/src/layout/index.vue
index dccf662..d6afcf6 100644
--- a/web_src/src/layout/index.vue
+++ b/web_src/src/layout/index.vue
@@ -24,6 +24,9 @@
}
</script>
<style>
+body{
+ font-family: sans-serif;
+}
/*瀹氫箟鏍囬鏍�*/
.page-header {
background-color: #FFFFFF;
--
Gitblit v1.8.0