Commit ca891f367c5b23ea841695c50ddbb7f08ae23292
1 parent
3ffe2050
首页改造完成,待添加系统信息
Showing
37 changed files
with
833 additions
and
119 deletions
src/main/java/com/genersoft/iot/vmp/common/SystemAllInfo.java
| ... | ... | @@ -8,6 +8,10 @@ public class SystemAllInfo { |
| 8 | 8 | private List<Object> mem; |
| 9 | 9 | private List<Object> net; |
| 10 | 10 | |
| 11 | + private long netTotal; | |
| 12 | + | |
| 13 | + private Object disk; | |
| 14 | + | |
| 11 | 15 | public List<Object> getCpu() { |
| 12 | 16 | return cpu; |
| 13 | 17 | } |
| ... | ... | @@ -31,4 +35,20 @@ public class SystemAllInfo { |
| 31 | 35 | public void setNet(List<Object> net) { |
| 32 | 36 | this.net = net; |
| 33 | 37 | } |
| 38 | + | |
| 39 | + public Object getDisk() { | |
| 40 | + return disk; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setDisk(Object disk) { | |
| 44 | + this.disk = disk; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public long getNetTotal() { | |
| 48 | + return netTotal; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setNetTotal(long netTotal) { | |
| 52 | + this.netTotal = netTotal; | |
| 53 | + } | |
| 34 | 54 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/common/SystemInfoDto.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.common; | |
| 2 | - | |
| 3 | -public class SystemInfoDto<T> { | |
| 4 | - private String time; | |
| 5 | - private T data; | |
| 6 | - | |
| 7 | - public String getTime() { | |
| 8 | - return time; | |
| 9 | - } | |
| 10 | - | |
| 11 | - public void setTime(String time) { | |
| 12 | - this.time = time; | |
| 13 | - } | |
| 14 | - | |
| 15 | - public T getData() { | |
| 16 | - return data; | |
| 17 | - } | |
| 18 | - | |
| 19 | - public void setData(T data) { | |
| 20 | - this.data = data; | |
| 21 | - } | |
| 22 | -} |
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
| ... | ... | @@ -27,11 +27,9 @@ public class VideoManagerConstants { |
| 27 | 27 | |
| 28 | 28 | public static final String KEEPLIVEKEY_PREFIX = "VMP_KEEPALIVE_"; |
| 29 | 29 | |
| 30 | - // 此处多了一个_,暂不修改 | |
| 30 | + // TODO 此处多了一个_,暂不修改 | |
| 31 | 31 | public static final String PLAYER_PREFIX = "VMP_PLAYER_"; |
| 32 | 32 | public static final String PLAY_BLACK_PREFIX = "VMP_PLAYBACK_"; |
| 33 | - public static final String PLAY_INFO_PREFIX = "VMP_PLAY_INFO_"; | |
| 34 | - | |
| 35 | 33 | public static final String DOWNLOAD_PREFIX = "VMP_DOWNLOAD_"; |
| 36 | 34 | |
| 37 | 35 | public static final String PLATFORM_KEEPALIVE_PREFIX = "VMP_PLATFORM_KEEPALIVE_"; |
| ... | ... | @@ -70,6 +68,8 @@ public class VideoManagerConstants { |
| 70 | 68 | |
| 71 | 69 | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; |
| 72 | 70 | |
| 71 | + public static final String SYSTEM_INFO_DISK_PREFIX = "VMP_SYSTEM_INFO_DISK_"; | |
| 72 | + | |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java
| ... | ... | @@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.scheduling.annotation.Scheduled; |
| 10 | 10 | import org.springframework.stereotype.Component; |
| 11 | 11 | |
| 12 | +import java.util.List; | |
| 12 | 13 | import java.util.Map; |
| 13 | 14 | |
| 14 | 15 | /** |
| ... | ... | @@ -31,6 +32,8 @@ public class SystemInfoTimerTask { |
| 31 | 32 | redisCatchStorage.addMemInfo(memInfo); |
| 32 | 33 | Map<String, Double> networkInterfaces = SystemInfoUtils.getNetworkInterfaces(); |
| 33 | 34 | redisCatchStorage.addNetInfo(networkInterfaces); |
| 35 | + List<Map<String, Object>> diskInfo =SystemInfoUtils.getDiskInfo(); | |
| 36 | + redisCatchStorage.addDiskInfo(diskInfo); | |
| 34 | 37 | } catch (InterruptedException e) { |
| 35 | 38 | logger.error("[获取系统信息失败] {}", e.getMessage()); |
| 36 | 39 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/task/SipDeviceRunner.java renamed to src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.task; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 3 | 4 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | |
| 7 | +import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | |
| 8 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | |
| 9 | +import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | |
| 10 | +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 5 | 11 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 12 | +import com.genersoft.iot.vmp.service.IMediaServerService; | |
| 13 | +import com.genersoft.iot.vmp.service.IPlatformService; | |
| 6 | 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 7 | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 8 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -10,8 +18,9 @@ import org.springframework.boot.CommandLineRunner; |
| 10 | 18 | import org.springframework.core.annotation.Order; |
| 11 | 19 | import org.springframework.stereotype.Component; |
| 12 | 20 | |
| 13 | -import java.util.ArrayList; | |
| 21 | +import java.util.HashMap; | |
| 14 | 22 | import java.util.List; |
| 23 | +import java.util.Map; | |
| 15 | 24 | |
| 16 | 25 | |
| 17 | 26 | /** |
| ... | ... | @@ -20,7 +29,7 @@ import java.util.List; |
| 20 | 29 | */ |
| 21 | 30 | @Component |
| 22 | 31 | @Order(value=4) |
| 23 | -public class SipDeviceRunner implements CommandLineRunner { | |
| 32 | +public class SipRunner implements CommandLineRunner { | |
| 24 | 33 | |
| 25 | 34 | @Autowired |
| 26 | 35 | private IVideoManagerStorage storager; |
| ... | ... | @@ -34,6 +43,18 @@ public class SipDeviceRunner implements CommandLineRunner { |
| 34 | 43 | @Autowired |
| 35 | 44 | private IDeviceService deviceService; |
| 36 | 45 | |
| 46 | + @Autowired | |
| 47 | + private ZLMRESTfulUtils zlmresTfulUtils; | |
| 48 | + | |
| 49 | + @Autowired | |
| 50 | + private IMediaServerService mediaServerService; | |
| 51 | + | |
| 52 | + @Autowired | |
| 53 | + private IPlatformService platformService; | |
| 54 | + | |
| 55 | + @Autowired | |
| 56 | + private ISIPCommanderForPlatform commanderForPlatform; | |
| 57 | + | |
| 37 | 58 | @Override |
| 38 | 59 | public void run(String... args) throws Exception { |
| 39 | 60 | List<Device> deviceList = deviceService.getAllOnlineDevice(); |
| ... | ... | @@ -47,5 +68,28 @@ public class SipDeviceRunner implements CommandLineRunner { |
| 47 | 68 | } |
| 48 | 69 | // 重置cseq计数 |
| 49 | 70 | redisCatchStorage.resetAllCSEQ(); |
| 71 | + // 清理redis | |
| 72 | + // 查找国标推流 | |
| 73 | + List<SendRtpItem> sendRtpItems = redisCatchStorage.queryAllSendRTPServer(); | |
| 74 | + if (sendRtpItems.size() > 0) { | |
| 75 | + for (SendRtpItem sendRtpItem : sendRtpItems) { | |
| 76 | + MediaServerItem mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | |
| 77 | + redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(),sendRtpItem.getChannelId(), sendRtpItem.getCallId(),sendRtpItem.getStreamId()); | |
| 78 | + if (mediaServerItem != null) { | |
| 79 | + Map<String, Object> param = new HashMap<>(); | |
| 80 | + param.put("vhost","__defaultVhost__"); | |
| 81 | + param.put("app",sendRtpItem.getApp()); | |
| 82 | + param.put("stream",sendRtpItem.getStreamId()); | |
| 83 | + param.put("ssrc",sendRtpItem.getSsrc()); | |
| 84 | + JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param); | |
| 85 | + if (jsonObject != null && jsonObject.getInteger("code") == 0) { | |
| 86 | + ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); | |
| 87 | + if (platform != null) { | |
| 88 | + commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId()); | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 92 | + } | |
| 93 | + } | |
| 50 | 94 | } |
| 51 | 95 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
| ... | ... | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 5 | 6 | |
| 6 | 7 | import java.util.List; |
| 7 | 8 | |
| ... | ... | @@ -32,4 +33,9 @@ public interface IDeviceChannelService { |
| 32 | 33 | */ |
| 33 | 34 | int updateChannels(String deviceId, List<DeviceChannel> channels); |
| 34 | 35 | |
| 36 | + /** | |
| 37 | + * 获取统计信息 | |
| 38 | + * @return | |
| 39 | + */ | |
| 40 | + ResourceBaceInfo getOverview(); | |
| 35 | 41 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
| ... | ... | @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.SyncStatus; |
| 6 | 6 | import com.genersoft.iot.vmp.vmanager.bean.BaseTree; |
| 7 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 7 | 8 | |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| ... | ... | @@ -155,4 +156,11 @@ public interface IDeviceService { |
| 155 | 156 | * @return |
| 156 | 157 | */ |
| 157 | 158 | boolean delete(String deviceId); |
| 159 | + | |
| 160 | + /** | |
| 161 | + * 获取统计信息 | |
| 162 | + * @return | |
| 163 | + */ | |
| 164 | + ResourceBaceInfo getOverview(); | |
| 165 | + | |
| 158 | 166 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
| ... | ... | @@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | 5 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| 6 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 7 | +import com.genersoft.iot.vmp.service.bean.MediaServerLoad; | |
| 7 | 8 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 8 | 9 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 9 | 10 | |
| 10 | 11 | import java.util.List; |
| 12 | +import java.util.Map; | |
| 11 | 13 | |
| 12 | 14 | /** |
| 13 | 15 | * 媒体服务节点 |
| ... | ... | @@ -87,4 +89,10 @@ public interface IMediaServerService { |
| 87 | 89 | void updateMediaServerKeepalive(String mediaServerId, JSONObject data); |
| 88 | 90 | |
| 89 | 91 | boolean checkRtpServer(MediaServerItem mediaServerItem, String rtp, String stream); |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 获取负载信息 | |
| 95 | + * @return | |
| 96 | + */ | |
| 97 | + MediaServerLoad getLoad(MediaServerItem mediaServerItem); | |
| 90 | 98 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java
| ... | ... | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | 5 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 6 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 7 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 7 | 8 | import com.github.pagehelper.PageInfo; |
| 8 | 9 | |
| 9 | 10 | public interface IStreamProxyService { |
| ... | ... | @@ -102,4 +103,11 @@ public interface IStreamProxyService { |
| 102 | 103 | * 更新代理流 |
| 103 | 104 | */ |
| 104 | 105 | boolean updateStreamProxy(StreamProxyItem streamProxyItem); |
| 106 | + | |
| 107 | + /** | |
| 108 | + * 获取统计信息 | |
| 109 | + * @return | |
| 110 | + */ | |
| 111 | + ResourceBaceInfo getOverview(); | |
| 112 | + | |
| 105 | 113 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
| ... | ... | @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 6 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 7 | 7 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 8 | 8 | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| 9 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 9 | 10 | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
| 10 | 11 | import com.github.pagehelper.PageInfo; |
| 11 | 12 | |
| ... | ... | @@ -106,4 +107,10 @@ public interface IStreamPushService { |
| 106 | 107 | * @return |
| 107 | 108 | */ |
| 108 | 109 | List<String> getAllAppAndStream(); |
| 110 | + | |
| 111 | + /** | |
| 112 | + * 获取统计信息 | |
| 113 | + * @return | |
| 114 | + */ | |
| 115 | + ResourceBaceInfo getOverview(); | |
| 109 | 116 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.service.bean; | |
| 2 | + | |
| 3 | +public class MediaServerLoad { | |
| 4 | + | |
| 5 | + private String id; | |
| 6 | + private int push; | |
| 7 | + private int proxy; | |
| 8 | + private int gbReceive; | |
| 9 | + private int gbSend; | |
| 10 | + | |
| 11 | + public String getId() { | |
| 12 | + return id; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setId(String id) { | |
| 16 | + this.id = id; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public int getPush() { | |
| 20 | + return push; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setPush(int push) { | |
| 24 | + this.push = push; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public int getProxy() { | |
| 28 | + return proxy; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setProxy(int proxy) { | |
| 32 | + this.proxy = proxy; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public int getGbReceive() { | |
| 36 | + return gbReceive; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setGbReceive(int gbReceive) { | |
| 40 | + this.gbReceive = gbReceive; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public int getGbSend() { | |
| 44 | + return gbSend; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setGbSend(int gbSend) { | |
| 48 | + this.gbSend = gbSend; | |
| 49 | + } | |
| 50 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
| ... | ... | @@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 9 | 9 | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| 10 | 10 | import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| 11 | 11 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 12 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 12 | 13 | import org.slf4j.Logger; |
| 13 | 14 | import org.slf4j.LoggerFactory; |
| 14 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -162,4 +163,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { |
| 162 | 163 | } |
| 163 | 164 | return addChannels.size() + updateChannels.size(); |
| 164 | 165 | } |
| 166 | + | |
| 167 | + @Override | |
| 168 | + public ResourceBaceInfo getOverview() { | |
| 169 | + return channelMapper.getOverview(); | |
| 170 | + } | |
| 165 | 171 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| ... | ... | @@ -19,6 +19,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| 19 | 19 | import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper; |
| 20 | 20 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 21 | 21 | import com.genersoft.iot.vmp.vmanager.bean.BaseTree; |
| 22 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 22 | 23 | import org.slf4j.Logger; |
| 23 | 24 | import org.slf4j.LoggerFactory; |
| 24 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -620,4 +621,9 @@ public class DeviceServiceImpl implements IDeviceService { |
| 620 | 621 | } |
| 621 | 622 | return result; |
| 622 | 623 | } |
| 624 | + | |
| 625 | + @Override | |
| 626 | + public ResourceBaceInfo getOverview() { | |
| 627 | + return deviceMapper.getOverview(); | |
| 628 | + } | |
| 623 | 629 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -10,6 +10,8 @@ import java.util.Set; |
| 10 | 10 | |
| 11 | 11 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 12 | 12 | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 13 | +import com.genersoft.iot.vmp.service.bean.MediaServerLoad; | |
| 14 | +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | |
| 13 | 15 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 14 | 16 | import org.slf4j.Logger; |
| 15 | 17 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -90,6 +92,9 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 90 | 92 | @Autowired |
| 91 | 93 | private DynamicTask dynamicTask; |
| 92 | 94 | |
| 95 | + @Autowired | |
| 96 | + private IRedisCatchStorage redisCatchStorage; | |
| 97 | + | |
| 93 | 98 | /** |
| 94 | 99 | * 初始化 |
| 95 | 100 | */ |
| ... | ... | @@ -691,4 +696,15 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 691 | 696 | } |
| 692 | 697 | return false; |
| 693 | 698 | } |
| 699 | + | |
| 700 | + @Override | |
| 701 | + public MediaServerLoad getLoad(MediaServerItem mediaServerItem) { | |
| 702 | + MediaServerLoad result = new MediaServerLoad(); | |
| 703 | + result.setId(mediaServerItem.getId()); | |
| 704 | + result.setPush(redisCatchStorage.getPushStreamCount(mediaServerItem.getId())); | |
| 705 | + result.setProxy(redisCatchStorage.getProxyStreamCount(mediaServerItem.getId())); | |
| 706 | + result.setGbReceive(redisCatchStorage.getGbReceiveCount(mediaServerItem.getId())); | |
| 707 | + result.setGbSend(redisCatchStorage.getGbSendCount(mediaServerItem.getId())); | |
| 708 | + return result; | |
| 709 | + } | |
| 694 | 710 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| ... | ... | @@ -26,6 +26,7 @@ import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper; |
| 26 | 26 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 27 | 27 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 28 | 28 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 29 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 29 | 30 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 30 | 31 | import com.github.pagehelper.PageInfo; |
| 31 | 32 | import org.slf4j.Logger; |
| ... | ... | @@ -454,4 +455,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 454 | 455 | } |
| 455 | 456 | |
| 456 | 457 | } |
| 458 | + | |
| 459 | + @Override | |
| 460 | + public ResourceBaceInfo getOverview() { | |
| 461 | + return streamProxyMapper.getOverview(); | |
| 462 | + } | |
| 457 | 463 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| ... | ... | @@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| 18 | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 19 | 19 | import com.genersoft.iot.vmp.storager.dao.*; |
| 20 | 20 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 21 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 21 | 22 | import com.github.pagehelper.PageHelper; |
| 22 | 23 | import com.github.pagehelper.PageInfo; |
| 23 | 24 | import org.slf4j.Logger; |
| ... | ... | @@ -507,6 +508,12 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 507 | 508 | |
| 508 | 509 | @Override |
| 509 | 510 | public List<String> getAllAppAndStream() { |
| 511 | + | |
| 510 | 512 | return streamPushMapper.getAllAppAndStream(); |
| 511 | 513 | } |
| 514 | + | |
| 515 | + @Override | |
| 516 | + public ResourceBaceInfo getOverview() { | |
| 517 | + return streamPushMapper.getOverview(userSetting.isUsePushingAsStatus()); | |
| 518 | + } | |
| 512 | 519 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| ... | ... | @@ -244,4 +244,16 @@ public interface IRedisCatchStorage { |
| 244 | 244 | |
| 245 | 245 | SystemAllInfo getSystemInfo(); |
| 246 | 246 | |
| 247 | + int getPushStreamCount(String id); | |
| 248 | + | |
| 249 | + int getProxyStreamCount(String id); | |
| 250 | + | |
| 251 | + int getGbReceiveCount(String id); | |
| 252 | + | |
| 253 | + int getGbSendCount(String id); | |
| 254 | + | |
| 255 | + void addDiskInfo(List<Map<String, Object>> diskInfo); | |
| 256 | + | |
| 257 | + List<SendRtpItem> queryAllSendRTPServer(); | |
| 258 | + | |
| 247 | 259 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| ... | ... | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao; |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; |
| 6 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 6 | 7 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 7 | 8 | import org.apache.ibatis.annotations.*; |
| 8 | 9 | import org.springframework.stereotype.Repository; |
| ... | ... | @@ -347,4 +348,8 @@ public interface DeviceChannelMapper { |
| 347 | 348 | |
| 348 | 349 | @Select("select * from device_channel where deviceId = #{deviceId}") |
| 349 | 350 | List<DeviceChannel> queryAllChannels(String deviceId); |
| 351 | + | |
| 352 | + | |
| 353 | + @Select("select count(1) as total, sum(status) as online from device_channel") | |
| 354 | + ResourceBaceInfo getOverview(); | |
| 350 | 355 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| 1 | 1 | package com.genersoft.iot.vmp.storager.dao; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 4 | 5 | import org.apache.ibatis.annotations.*; |
| 5 | 6 | import org.springframework.stereotype.Repository; |
| 6 | 7 | |
| ... | ... | @@ -251,4 +252,8 @@ public interface DeviceMapper { |
| 251 | 252 | "#{online}" + |
| 252 | 253 | ")") |
| 253 | 254 | void addCustomDevice(Device device); |
| 255 | + | |
| 256 | + @Select("select count(1) as total, sum(online) as online from device") | |
| 257 | + ResourceBaceInfo getOverview(); | |
| 258 | + | |
| 254 | 259 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
| 1 | 1 | package com.genersoft.iot.vmp.storager.dao; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 4 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 4 | 5 | import org.apache.ibatis.annotations.*; |
| 5 | 6 | import org.springframework.stereotype.Repository; |
| 6 | 7 | |
| ... | ... | @@ -75,4 +76,7 @@ public interface StreamProxyMapper { |
| 75 | 76 | |
| 76 | 77 | @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") |
| 77 | 78 | List<StreamProxyItem> selecAutoRemoveItemByMediaServerId(String mediaServerId); |
| 79 | + | |
| 80 | + @Select("select count(1) as total, sum(status) as online from stream_proxy") | |
| 81 | + ResourceBaceInfo getOverview(); | |
| 78 | 82 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
| ... | ... | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao; |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | 4 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 5 | 5 | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| 6 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 6 | 7 | import org.apache.ibatis.annotations.*; |
| 7 | 8 | // import org.omg.PortableInterceptor.INACTIVE; |
| 8 | 9 | import org.springframework.stereotype.Repository; |
| ... | ... | @@ -171,4 +172,10 @@ public interface StreamPushMapper { |
| 171 | 172 | |
| 172 | 173 | @Select("SELECT CONCAT(app,stream) FROM gb_stream") |
| 173 | 174 | List<String> getAllAppAndStream(); |
| 175 | + | |
| 176 | + @Select(value = {" <script>" + | |
| 177 | + " <if test='pushIngAsOnline == true'> select count(1) as total, sum(pushIng) as online from stream_push </if>" + | |
| 178 | + " <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from stream_push </if>" + | |
| 179 | + " </script>"}) | |
| 180 | + ResourceBaceInfo getOverview(boolean pushIngAsOnline); | |
| 174 | 181 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| ... | ... | @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 6 | 6 | import com.genersoft.iot.vmp.common.SystemAllInfo; |
| 7 | -import com.genersoft.iot.vmp.common.SystemInfoDto; | |
| 8 | 7 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 9 | 8 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 10 | 9 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| ... | ... | @@ -18,6 +17,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 18 | 17 | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| 19 | 18 | import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo; |
| 20 | 19 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 20 | +import com.genersoft.iot.vmp.utils.SystemInfoUtils; | |
| 21 | 21 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 22 | 22 | import org.slf4j.Logger; |
| 23 | 23 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -89,8 +89,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 89 | 89 | */ |
| 90 | 90 | @Override |
| 91 | 91 | public boolean startPlay(StreamInfo stream) { |
| 92 | - return RedisUtil.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), | |
| 93 | - stream.getStream(), stream.getDeviceID(), stream.getChannelId()), | |
| 92 | + | |
| 93 | + return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), | |
| 94 | + stream.getMediaServerId(), stream.getStream(), stream.getDeviceID(), stream.getChannelId()), | |
| 94 | 95 | stream); |
| 95 | 96 | } |
| 96 | 97 | |
| ... | ... | @@ -104,8 +105,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 104 | 105 | if (streamInfo == null) { |
| 105 | 106 | return false; |
| 106 | 107 | } |
| 107 | - return RedisUtil.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | |
| 108 | + return RedisUtil.del(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | |
| 108 | 109 | userSetting.getServerId(), |
| 110 | + streamInfo.getMediaServerId(), | |
| 109 | 111 | streamInfo.getStream(), |
| 110 | 112 | streamInfo.getDeviceID(), |
| 111 | 113 | streamInfo.getChannelId())); |
| ... | ... | @@ -117,17 +119,17 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 117 | 119 | */ |
| 118 | 120 | @Override |
| 119 | 121 | public StreamInfo queryPlay(StreamInfo streamInfo) { |
| 120 | - return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s", | |
| 122 | + return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s_%s", | |
| 121 | 123 | VideoManagerConstants.PLAYER_PREFIX, |
| 122 | 124 | userSetting.getServerId(), |
| 125 | + streamInfo.getMediaServerId(), | |
| 123 | 126 | streamInfo.getStream(), |
| 124 | 127 | streamInfo.getDeviceID(), |
| 125 | 128 | streamInfo.getChannelId())); |
| 126 | 129 | } |
| 127 | 130 | @Override |
| 128 | 131 | public StreamInfo queryPlayByStreamId(String streamId) { |
| 129 | - System.out.println(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); | |
| 130 | - List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); | |
| 132 | + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); | |
| 131 | 133 | if (playLeys == null || playLeys.size() == 0) { |
| 132 | 134 | return null; |
| 133 | 135 | } |
| ... | ... | @@ -136,7 +138,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 136 | 138 | |
| 137 | 139 | @Override |
| 138 | 140 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
| 139 | - List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | |
| 141 | + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | |
| 140 | 142 | userSetting.getServerId(), |
| 141 | 143 | deviceId, |
| 142 | 144 | channelId)); |
| ... | ... | @@ -149,8 +151,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 149 | 151 | @Override |
| 150 | 152 | public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { |
| 151 | 153 | Map<String, StreamInfo> streamInfos = new HashMap<>(); |
| 152 | -// List<Object> playLeys = RedisUtil.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); | |
| 153 | - List<Object> players = RedisUtil.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); | |
| 154 | + List<Object> players = RedisUtil.scan(String.format("%S_%s_*_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); | |
| 154 | 155 | if (players.size() == 0) { |
| 155 | 156 | return streamInfos; |
| 156 | 157 | } |
| ... | ... | @@ -165,21 +166,19 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 165 | 166 | |
| 166 | 167 | @Override |
| 167 | 168 | public boolean startPlayback(StreamInfo stream, String callId) { |
| 168 | - System.out.println(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 169 | - userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId)); | |
| 170 | - return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 171 | - userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 169 | + return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 170 | + userSetting.getServerId(), stream.getMediaServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 172 | 171 | } |
| 173 | 172 | |
| 174 | 173 | @Override |
| 175 | 174 | public boolean startDownload(StreamInfo stream, String callId) { |
| 176 | 175 | boolean result; |
| 177 | 176 | if (stream.getProgress() == 1) { |
| 178 | - result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 179 | - userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 177 | + result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 178 | + userSetting.getServerId(), stream.getMediaServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | |
| 180 | 179 | }else { |
| 181 | - result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 182 | - userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); | |
| 180 | + result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 181 | + userSetting.getServerId(), stream.getMediaServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); | |
| 183 | 182 | } |
| 184 | 183 | return result; |
| 185 | 184 | } |
| ... | ... | @@ -203,7 +202,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 203 | 202 | if (callId == null) { |
| 204 | 203 | callId = "*"; |
| 205 | 204 | } |
| 206 | - String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 205 | + String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 207 | 206 | userSetting.getServerId(), |
| 208 | 207 | deviceId, |
| 209 | 208 | channelId, |
| ... | ... | @@ -239,7 +238,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 239 | 238 | if (callId == null) { |
| 240 | 239 | callId = "*"; |
| 241 | 240 | } |
| 242 | - String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 241 | + String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 243 | 242 | userSetting.getServerId(), |
| 244 | 243 | deviceId, |
| 245 | 244 | channelId, |
| ... | ... | @@ -272,7 +271,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 272 | 271 | if (callId == null) { |
| 273 | 272 | callId = "*"; |
| 274 | 273 | } |
| 275 | - String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 274 | + String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 276 | 275 | userSetting.getServerId(), |
| 277 | 276 | deviceId, |
| 278 | 277 | channelId, |
| ... | ... | @@ -304,7 +303,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 304 | 303 | if (callId == null) { |
| 305 | 304 | callId = "*"; |
| 306 | 305 | } |
| 307 | - String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 306 | + String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 308 | 307 | userSetting.getServerId(), |
| 309 | 308 | deviceId, |
| 310 | 309 | channelId, |
| ... | ... | @@ -369,9 +368,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 369 | 368 | |
| 370 | 369 | @Override |
| 371 | 370 | public void updateSendRTPSever(SendRtpItem sendRtpItem) { |
| 372 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" | |
| 373 | - + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" | |
| 374 | - + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); | |
| 371 | + | |
| 372 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + | |
| 373 | + userSetting.getServerId() + "_" | |
| 374 | + + sendRtpItem.getMediaServerId() + "_" | |
| 375 | + + sendRtpItem.getPlatformId() + "_" | |
| 376 | + + sendRtpItem.getChannelId() + "_" | |
| 377 | + + sendRtpItem.getStreamId() + "_" | |
| 378 | + + sendRtpItem.getCallId(); | |
| 375 | 379 | RedisUtil.set(key, sendRtpItem); |
| 376 | 380 | } |
| 377 | 381 | |
| ... | ... | @@ -389,8 +393,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 389 | 393 | if (callId == null) { |
| 390 | 394 | callId = "*"; |
| 391 | 395 | } |
| 392 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | |
| 393 | - + "_" + channelId + "_" + streamId + "_" + callId; | |
| 396 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 397 | + + userSetting.getServerId() + "_*_" | |
| 398 | + + platformGbId + "_" | |
| 399 | + + channelId + "_" | |
| 400 | + + streamId + "_" | |
| 401 | + + callId; | |
| 394 | 402 | List<Object> scan = RedisUtil.scan(key); |
| 395 | 403 | if (scan.size() > 0) { |
| 396 | 404 | return (SendRtpItem)RedisUtil.get((String)scan.get(0)); |
| ... | ... | @@ -407,8 +415,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 407 | 415 | String platformGbId = "*"; |
| 408 | 416 | String callId = "*"; |
| 409 | 417 | String streamId = "*"; |
| 410 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | |
| 411 | - + "_" + channelId + "_" + streamId + "_" + callId; | |
| 418 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 419 | + + userSetting.getServerId() + "_*_" | |
| 420 | + + platformGbId + "_" | |
| 421 | + + channelId + "_" | |
| 422 | + + streamId + "_" | |
| 423 | + + callId; | |
| 412 | 424 | List<Object> scan = RedisUtil.scan(key); |
| 413 | 425 | List<SendRtpItem> result = new ArrayList<>(); |
| 414 | 426 | for (Object o : scan) { |
| ... | ... | @@ -425,8 +437,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 425 | 437 | String platformGbId = "*"; |
| 426 | 438 | String callId = "*"; |
| 427 | 439 | String channelId = "*"; |
| 428 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | |
| 429 | - + "_" + channelId + "_" + stream + "_" + callId; | |
| 440 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 441 | + + userSetting.getServerId() + "_*_" | |
| 442 | + + platformGbId + "_" | |
| 443 | + + channelId + "_" | |
| 444 | + + stream + "_" | |
| 445 | + + callId; | |
| 430 | 446 | List<Object> scan = RedisUtil.scan(key); |
| 431 | 447 | List<SendRtpItem> result = new ArrayList<>(); |
| 432 | 448 | for (Object o : scan) { |
| ... | ... | @@ -440,7 +456,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 440 | 456 | if (platformGbId == null) { |
| 441 | 457 | platformGbId = "*"; |
| 442 | 458 | } |
| 443 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; | |
| 459 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 460 | + + userSetting.getServerId() + "_*_" | |
| 461 | + + platformGbId + "_*" + "_*" + "_*"; | |
| 444 | 462 | List<Object> queryResult = RedisUtil.scan(key); |
| 445 | 463 | List<SendRtpItem> result= new ArrayList<>(); |
| 446 | 464 | |
| ... | ... | @@ -465,8 +483,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 465 | 483 | if (callId == null) { |
| 466 | 484 | callId = "*"; |
| 467 | 485 | } |
| 468 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | |
| 469 | - + "_" + channelId + "_" + streamId + "_" + callId; | |
| 486 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 487 | + + userSetting.getServerId() + "_*_" | |
| 488 | + + platformGbId + "_" | |
| 489 | + + channelId + "_" | |
| 490 | + + streamId + "_" | |
| 491 | + + callId; | |
| 470 | 492 | List<Object> scan = RedisUtil.scan(key); |
| 471 | 493 | if (scan.size() > 0) { |
| 472 | 494 | for (Object keyStr : scan) { |
| ... | ... | @@ -475,7 +497,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 475 | 497 | } |
| 476 | 498 | } |
| 477 | 499 | |
| 500 | + @Override | |
| 501 | + public List<SendRtpItem> queryAllSendRTPServer() { | |
| 502 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 503 | + + userSetting.getServerId() + "_*"; | |
| 504 | + List<Object> queryResult = RedisUtil.scan(key); | |
| 505 | + List<SendRtpItem> result= new ArrayList<>(); | |
| 478 | 506 | |
| 507 | + for (Object o : queryResult) { | |
| 508 | + String keyItem = (String) o; | |
| 509 | + result.add((SendRtpItem) RedisUtil.get(keyItem)); | |
| 510 | + } | |
| 511 | + | |
| 512 | + return result; | |
| 513 | + } | |
| 479 | 514 | |
| 480 | 515 | /** |
| 481 | 516 | * 查询某个通道是否存在上级点播(RTP推送) |
| ... | ... | @@ -483,7 +518,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 483 | 518 | */ |
| 484 | 519 | @Override |
| 485 | 520 | public boolean isChannelSendingRTP(String channelId) { |
| 486 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; | |
| 521 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 522 | + + userSetting.getServerId() + "_*_*_" | |
| 523 | + + channelId + "*_" + "*_"; | |
| 487 | 524 | List<Object> RtpStreams = RedisUtil.scan(key); |
| 488 | 525 | if (RtpStreams.size() > 0) { |
| 489 | 526 | return true; |
| ... | ... | @@ -503,7 +540,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 503 | 540 | } |
| 504 | 541 | } |
| 505 | 542 | |
| 506 | - List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 543 | + List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_*_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 507 | 544 | userSetting.getServerId(), |
| 508 | 545 | deviceId)); |
| 509 | 546 | if (playBackers.size() > 0) { |
| ... | ... | @@ -569,7 +606,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 569 | 606 | if (callId == null) { |
| 570 | 607 | callId = "*"; |
| 571 | 608 | } |
| 572 | - String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 609 | + String key = String.format("%S_%s_*_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | |
| 573 | 610 | userSetting.getServerId(), |
| 574 | 611 | deviceId, |
| 575 | 612 | channelId, |
| ... | ... | @@ -740,14 +777,25 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 740 | 777 | } |
| 741 | 778 | |
| 742 | 779 | @Override |
| 780 | + public void addDiskInfo(List<Map<String, Object>> diskInfo) { | |
| 781 | + | |
| 782 | + String key = VideoManagerConstants.SYSTEM_INFO_DISK_PREFIX + userSetting.getServerId(); | |
| 783 | + RedisUtil.set(key, diskInfo); | |
| 784 | + } | |
| 785 | + | |
| 786 | + @Override | |
| 743 | 787 | public SystemAllInfo getSystemInfo() { |
| 744 | 788 | String cpuKey = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetting.getServerId(); |
| 745 | 789 | String memKey = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetting.getServerId(); |
| 746 | 790 | String netKey = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetting.getServerId(); |
| 791 | + String diskKey = VideoManagerConstants.SYSTEM_INFO_DISK_PREFIX + userSetting.getServerId(); | |
| 747 | 792 | SystemAllInfo systemAllInfo = new SystemAllInfo(); |
| 748 | 793 | systemAllInfo.setCpu(RedisUtil.lGet(cpuKey, 0, -1)); |
| 749 | 794 | systemAllInfo.setMem(RedisUtil.lGet(memKey, 0, -1)); |
| 750 | 795 | systemAllInfo.setNet(RedisUtil.lGet(netKey, 0, -1)); |
| 796 | + | |
| 797 | + systemAllInfo.setDisk(RedisUtil.get(diskKey)); | |
| 798 | + systemAllInfo.setNetTotal(SystemInfoUtils.getNetworkTotal()); | |
| 751 | 799 | return systemAllInfo; |
| 752 | 800 | } |
| 753 | 801 | |
| ... | ... | @@ -786,4 +834,32 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 786 | 834 | jsonObject.put(key, key); |
| 787 | 835 | RedisUtil.convertAndSend(key, jsonObject); |
| 788 | 836 | } |
| 837 | + | |
| 838 | + @Override | |
| 839 | + public int getPushStreamCount(String id) { | |
| 840 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_PUSH_*_*_" + id; | |
| 841 | + return RedisUtil.scan(key).size(); | |
| 842 | + } | |
| 843 | + | |
| 844 | + @Override | |
| 845 | + public int getProxyStreamCount(String id) { | |
| 846 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_PULL_*_*_" + id; | |
| 847 | + return RedisUtil.scan(key).size(); | |
| 848 | + } | |
| 849 | + | |
| 850 | + @Override | |
| 851 | + public int getGbReceiveCount(String id) { | |
| 852 | + String playKey = VideoManagerConstants.PLAYER_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*"; | |
| 853 | + String playBackKey = VideoManagerConstants.PLAY_BLACK_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*"; | |
| 854 | + String downloadKey = VideoManagerConstants.DOWNLOAD_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*"; | |
| 855 | + | |
| 856 | + return RedisUtil.scan(playKey).size() + RedisUtil.scan(playBackKey).size() + RedisUtil.scan(downloadKey).size(); | |
| 857 | + } | |
| 858 | + | |
| 859 | + @Override | |
| 860 | + public int getGbSendCount(String id) { | |
| 861 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX | |
| 862 | + + userSetting.getServerId() + "_*_" + id + "_*"; | |
| 863 | + return RedisUtil.scan(key).size(); | |
| 864 | + } | |
| 789 | 865 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
| ... | ... | @@ -13,7 +13,7 @@ public class GitUtil { |
| 13 | 13 | |
| 14 | 14 | @Value("${git.branch:}") |
| 15 | 15 | private String branch; |
| 16 | - @Value("${git.commit.id:}") | |
| 16 | + @Value("${git.commit.id.abbrev:}") | |
| 17 | 17 | private String gitCommitId; |
| 18 | 18 | @Value("${git.remote.origin.url:}") |
| 19 | 19 | private String gitUrl; | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
| 1 | 1 | package com.genersoft.iot.vmp.utils; |
| 2 | 2 | |
| 3 | +import org.springframework.util.ObjectUtils; | |
| 3 | 4 | import oshi.SystemInfo; |
| 4 | -import oshi.hardware.CentralProcessor; | |
| 5 | -import oshi.hardware.GlobalMemory; | |
| 6 | -import oshi.hardware.HardwareAbstractionLayer; | |
| 7 | -import oshi.hardware.NetworkIF; | |
| 5 | +import oshi.hardware.*; | |
| 8 | 6 | import oshi.software.os.OperatingSystem; |
| 9 | 7 | import oshi.util.FormatUtil; |
| 10 | 8 | |
| 9 | +import java.io.File; | |
| 11 | 10 | import java.text.DecimalFormat; |
| 11 | +import java.util.ArrayList; | |
| 12 | 12 | import java.util.HashMap; |
| 13 | 13 | import java.util.List; |
| 14 | 14 | import java.util.Map; |
| ... | ... | @@ -85,6 +85,19 @@ public class SystemInfoUtils { |
| 85 | 85 | return map; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | + /** | |
| 89 | + * 获取带宽总值 | |
| 90 | + * @return | |
| 91 | + */ | |
| 92 | + public static long getNetworkTotal() { | |
| 93 | + SystemInfo si = new SystemInfo(); | |
| 94 | + HardwareAbstractionLayer hal = si.getHardware(); | |
| 95 | + List<NetworkIF> recvNetworkIFs = hal.getNetworkIFs(); | |
| 96 | + NetworkIF networkIF= recvNetworkIFs.get(recvNetworkIFs.size() - 1); | |
| 97 | + | |
| 98 | + return networkIF.getSpeed()/1048576L/8L; | |
| 99 | + } | |
| 100 | + | |
| 88 | 101 | public static double formatUnits(long value, long prefix) { |
| 89 | 102 | return (double)value / (double)prefix; |
| 90 | 103 | } |
| ... | ... | @@ -100,4 +113,31 @@ public class SystemInfoUtils { |
| 100 | 113 | int processCount = os.getProcessCount(); |
| 101 | 114 | return processCount; |
| 102 | 115 | } |
| 116 | + | |
| 117 | + public static List<Map<String, Object>> getDiskInfo() { | |
| 118 | + List<Map<String, Object>> result = new ArrayList<>(); | |
| 119 | + | |
| 120 | + String osName = System.getProperty("os.name"); | |
| 121 | + List<String> pathArray = new ArrayList<>(); | |
| 122 | + if (osName.startsWith("Mac OS")) { | |
| 123 | + // 苹果 | |
| 124 | + pathArray.add("/"); | |
| 125 | + } else if (osName.startsWith("Windows")) { | |
| 126 | + // windows | |
| 127 | + pathArray.add("C:"); | |
| 128 | + } else { | |
| 129 | + pathArray.add("/"); | |
| 130 | + pathArray.add("/home"); | |
| 131 | + } | |
| 132 | + for (String path : pathArray) { | |
| 133 | + Map<String, Object> infoMap = new HashMap<>(); | |
| 134 | + infoMap.put("path", path); | |
| 135 | + File partitionFile = new File(path); | |
| 136 | + // 单位: GB | |
| 137 | + infoMap.put("use", (partitionFile.getTotalSpace() - partitionFile.getFreeSpace())/1024/1024/1024D); | |
| 138 | + infoMap.put("free", partitionFile.getFreeSpace()/1024/1024/1024D); | |
| 139 | + result.add(infoMap); | |
| 140 | + } | |
| 141 | + return result; | |
| 142 | + } | |
| 103 | 143 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.bean; | |
| 2 | + | |
| 3 | +public class ResourceBaceInfo { | |
| 4 | + private int total; | |
| 5 | + private int online; | |
| 6 | + | |
| 7 | + public int getTotal() { | |
| 8 | + return total; | |
| 9 | + } | |
| 10 | + | |
| 11 | + public void setTotal(int total) { | |
| 12 | + this.total = total; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public int getOnline() { | |
| 16 | + return online; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setOnline(int online) { | |
| 20 | + this.online = online; | |
| 21 | + } | |
| 22 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.bean; | |
| 2 | + | |
| 3 | +public class ResourceInfo { | |
| 4 | + | |
| 5 | + private ResourceBaceInfo device; | |
| 6 | + private ResourceBaceInfo channel; | |
| 7 | + private ResourceBaceInfo push; | |
| 8 | + private ResourceBaceInfo proxy; | |
| 9 | + | |
| 10 | + public ResourceBaceInfo getDevice() { | |
| 11 | + return device; | |
| 12 | + } | |
| 13 | + | |
| 14 | + public void setDevice(ResourceBaceInfo device) { | |
| 15 | + this.device = device; | |
| 16 | + } | |
| 17 | + | |
| 18 | + public ResourceBaceInfo getChannel() { | |
| 19 | + return channel; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void setChannel(ResourceBaceInfo channel) { | |
| 23 | + this.channel = channel; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public ResourceBaceInfo getPush() { | |
| 27 | + return push; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setPush(ResourceBaceInfo push) { | |
| 31 | + this.push = push; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public ResourceBaceInfo getProxy() { | |
| 35 | + return proxy; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setProxy(ResourceBaceInfo proxy) { | |
| 39 | + this.proxy = proxy; | |
| 40 | + } | |
| 41 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
| ... | ... | @@ -12,10 +12,13 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 12 | 12 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; |
| 13 | 13 | import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe; |
| 14 | 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 15 | -import com.genersoft.iot.vmp.service.IMediaServerService; | |
| 15 | +import com.genersoft.iot.vmp.service.*; | |
| 16 | +import com.genersoft.iot.vmp.service.bean.MediaServerLoad; | |
| 16 | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 17 | 18 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
| 18 | 19 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 20 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; | |
| 21 | +import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo; | |
| 19 | 22 | import gov.nist.javax.sip.SipStackImpl; |
| 20 | 23 | |
| 21 | 24 | import io.swagger.v3.oas.annotations.Operation; |
| ... | ... | @@ -30,8 +33,7 @@ import org.springframework.web.bind.annotation.*; |
| 30 | 33 | import javax.sip.ListeningPoint; |
| 31 | 34 | import javax.sip.ObjectInUseException; |
| 32 | 35 | import javax.sip.SipProvider; |
| 33 | -import java.util.Iterator; | |
| 34 | -import java.util.List; | |
| 36 | +import java.util.*; | |
| 35 | 37 | |
| 36 | 38 | @SuppressWarnings("rawtypes") |
| 37 | 39 | @Tag(name = "服务控制") |
| ... | ... | @@ -55,6 +57,20 @@ public class ServerController { |
| 55 | 57 | @Autowired |
| 56 | 58 | private UserSetting userSetting; |
| 57 | 59 | |
| 60 | + @Autowired | |
| 61 | + private IDeviceService deviceService; | |
| 62 | + | |
| 63 | + @Autowired | |
| 64 | + private IDeviceChannelService channelService; | |
| 65 | + | |
| 66 | + @Autowired | |
| 67 | + private IStreamPushService pushService; | |
| 68 | + | |
| 69 | + | |
| 70 | + @Autowired | |
| 71 | + private IStreamProxyService proxyService; | |
| 72 | + | |
| 73 | + | |
| 58 | 74 | @Value("${server.port}") |
| 59 | 75 | private int serverPort; |
| 60 | 76 | |
| ... | ... | @@ -213,6 +229,40 @@ public class ServerController { |
| 213 | 229 | @Operation(summary = "获取系统信息") |
| 214 | 230 | public SystemAllInfo getSystemInfo() { |
| 215 | 231 | SystemAllInfo systemAllInfo = redisCatchStorage.getSystemInfo(); |
| 232 | + | |
| 216 | 233 | return systemAllInfo; |
| 217 | 234 | } |
| 235 | + | |
| 236 | + @GetMapping(value = "/media_server/load") | |
| 237 | + @ResponseBody | |
| 238 | + @Operation(summary = "获取负载信息") | |
| 239 | + public List<MediaServerLoad> getMediaLoad() { | |
| 240 | + List<MediaServerLoad> result = new ArrayList<>(); | |
| 241 | + List<MediaServerItem> allOnline = mediaServerService.getAllOnline(); | |
| 242 | + if (allOnline.size() == 0) { | |
| 243 | + return result; | |
| 244 | + }else { | |
| 245 | + for (MediaServerItem mediaServerItem : allOnline) { | |
| 246 | + result.add(mediaServerService.getLoad(mediaServerItem)); | |
| 247 | + } | |
| 248 | + } | |
| 249 | + return result; | |
| 250 | + } | |
| 251 | + | |
| 252 | + @GetMapping(value = "/resource/info") | |
| 253 | + @ResponseBody | |
| 254 | + @Operation(summary = "获取负载信息") | |
| 255 | + public ResourceInfo getResourceInfo() { | |
| 256 | + ResourceInfo result = new ResourceInfo(); | |
| 257 | + ResourceBaceInfo deviceInfo = deviceService.getOverview(); | |
| 258 | + result.setDevice(deviceInfo); | |
| 259 | + ResourceBaceInfo channelInfo = channelService.getOverview(); | |
| 260 | + result.setChannel(channelInfo); | |
| 261 | + ResourceBaceInfo pushInfo = pushService.getOverview(); | |
| 262 | + result.setPush(pushInfo); | |
| 263 | + ResourceBaceInfo proxyInfo = proxyService.getOverview(); | |
| 264 | + result.setProxy(proxyInfo); | |
| 265 | + | |
| 266 | + return result; | |
| 267 | + } | |
| 218 | 268 | } | ... | ... |
web_src/src/components/console.vue
| ... | ... | @@ -2,6 +2,10 @@ |
| 2 | 2 | <div id="app" style="width: 100%"> |
| 3 | 3 | <div class="page-header"> |
| 4 | 4 | <div class="page-title">控制台</div> |
| 5 | + <div class="page-header-btn"> | |
| 6 | + <el-button icon="el-icon-info" size="mini" style="margin-right: 1rem;" type="primary" @click="showInfo">平台信息 | |
| 7 | + </el-button> | |
| 8 | + </div> | |
| 5 | 9 | </div> |
| 6 | 10 | <el-row style="width: 100%"> |
| 7 | 11 | <el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" > |
| ... | ... | @@ -14,7 +18,7 @@ |
| 14 | 18 | <el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" > |
| 15 | 19 | <div class="control-cell" id="WorkThreadsLoad" > |
| 16 | 20 | <div style="width:100%; height:100%; "> |
| 17 | - <consoleMem ref="consoleMem"></consoleMem> | |
| 21 | + <consoleResource ref="consoleResource"></consoleResource> | |
| 18 | 22 | </div> |
| 19 | 23 | </div> |
| 20 | 24 | </el-col> |
| ... | ... | @@ -28,26 +32,25 @@ |
| 28 | 32 | <el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" > |
| 29 | 33 | <div class="control-cell" id="WorkThreadsLoad" > |
| 30 | 34 | <div style="width:100%; height:100%; "> |
| 31 | - <consoleCPU></consoleCPU> | |
| 35 | + | |
| 36 | + <consoleMem ref="consoleMem"></consoleMem> | |
| 32 | 37 | </div> |
| 33 | 38 | </div> |
| 34 | 39 | </el-col> |
| 35 | 40 | <el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" > |
| 36 | 41 | <div class="control-cell" id="WorkThreadsLoad" > |
| 37 | 42 | <div style="width:100%; height:100%; "> |
| 38 | - <consoleCPU></consoleCPU> | |
| 43 | + <consoleNodeLoad ref="consoleNodeLoad"></consoleNodeLoad> | |
| 39 | 44 | </div> |
| 40 | 45 | </div> |
| 41 | 46 | </el-col> |
| 42 | 47 | <el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" > |
| 43 | 48 | <div class="control-cell" id="WorkThreadsLoad" > |
| 44 | 49 | <div style="width:100%; height:100%; "> |
| 45 | - <consoleCPU></consoleCPU> | |
| 50 | + <consoleDisk ref="consoleDisk"></consoleDisk> | |
| 46 | 51 | </div> |
| 47 | 52 | </div> |
| 48 | 53 | </el-col> |
| 49 | - | |
| 50 | - | |
| 51 | 54 | </el-row> |
| 52 | 55 | </div> |
| 53 | 56 | </template> |
| ... | ... | @@ -57,6 +60,9 @@ import uiHeader from '../layout/UiHeader.vue' |
| 57 | 60 | import consoleCPU from './console/ConsoleCPU.vue' |
| 58 | 61 | import consoleMem from './console/ConsoleMEM.vue' |
| 59 | 62 | import consoleNet from './console/ConsoleNet.vue' |
| 63 | +import consoleNodeLoad from './console/ConsoleNodeLoad.vue' | |
| 64 | +import consoleDisk from './console/ConsoleDisk.vue' | |
| 65 | +import consoleResource from './console/ConsoleResource.vue' | |
| 60 | 66 | |
| 61 | 67 | import echarts from 'echarts'; |
| 62 | 68 | |
| ... | ... | @@ -67,7 +73,10 @@ export default { |
| 67 | 73 | uiHeader, |
| 68 | 74 | consoleCPU, |
| 69 | 75 | consoleMem, |
| 70 | - consoleNet | |
| 76 | + consoleNet, | |
| 77 | + consoleNodeLoad, | |
| 78 | + consoleDisk, | |
| 79 | + consoleResource, | |
| 71 | 80 | }, |
| 72 | 81 | data() { |
| 73 | 82 | return { |
| ... | ... | @@ -76,7 +85,10 @@ export default { |
| 76 | 85 | }, |
| 77 | 86 | created() { |
| 78 | 87 | this.getSystemInfo(); |
| 88 | + this.getLoad(); | |
| 89 | + this.getResourceInfo(); | |
| 79 | 90 | this.loopForSystemInfo(); |
| 91 | + | |
| 80 | 92 | }, |
| 81 | 93 | destroyed() { |
| 82 | 94 | }, |
| ... | ... | @@ -87,8 +99,10 @@ export default { |
| 87 | 99 | } |
| 88 | 100 | this.timer = setTimeout(()=>{ |
| 89 | 101 | this.getSystemInfo(); |
| 102 | + this.getLoad(); | |
| 90 | 103 | this.timer = null; |
| 91 | 104 | this.loopForSystemInfo() |
| 105 | + this.getResourceInfo() | |
| 92 | 106 | }, 2000) |
| 93 | 107 | }, |
| 94 | 108 | getSystemInfo: function (){ |
| ... | ... | @@ -99,11 +113,38 @@ export default { |
| 99 | 113 | if (res.data.code === 0) { |
| 100 | 114 | this.$refs.consoleCPU.setData(res.data.data.cpu) |
| 101 | 115 | this.$refs.consoleMem.setData(res.data.data.mem) |
| 102 | - this.$refs.consoleNet.setData(res.data.data.net) | |
| 116 | + this.$refs.consoleNet.setData(res.data.data.net, res.data.data.netTotal) | |
| 117 | + this.$refs.consoleDisk.setData(res.data.data.disk) | |
| 103 | 118 | } |
| 104 | 119 | }).catch( (error)=> { |
| 105 | 120 | }); |
| 121 | + }, | |
| 122 | + getLoad: function (){ | |
| 123 | + this.$axios({ | |
| 124 | + method: 'get', | |
| 125 | + url: `/api/server/media_server/load`, | |
| 126 | + }).then( (res)=> { | |
| 127 | + if (res.data.code === 0) { | |
| 128 | + this.$refs.consoleNodeLoad.setData(res.data.data) | |
| 129 | + } | |
| 130 | + }).catch( (error)=> { | |
| 131 | + }); | |
| 132 | + }, | |
| 133 | + getResourceInfo: function (){ | |
| 134 | + this.$axios({ | |
| 135 | + method: 'get', | |
| 136 | + url: `/api/server/resource/info`, | |
| 137 | + }).then( (res)=> { | |
| 138 | + if (res.data.code === 0) { | |
| 139 | + this.$refs.consoleResource.setData(res.data.data) | |
| 140 | + } | |
| 141 | + }).catch( (error)=> { | |
| 142 | + }); | |
| 143 | + }, | |
| 144 | + showInfo: function (){ | |
| 145 | + | |
| 106 | 146 | } |
| 147 | + | |
| 107 | 148 | } |
| 108 | 149 | }; |
| 109 | 150 | </script> | ... | ... |
web_src/src/components/console/ConsoleCPU.vue
| 1 | 1 | <template> |
| 2 | 2 | <div id="consoleCPU" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> |
| 3 | - <ve-line :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line> | |
| 3 | + <ve-line ref="consoleCPU" :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line> | |
| 4 | 4 | </div> |
| 5 | 5 | </template> |
| 6 | 6 | |
| ... | ... | @@ -59,7 +59,8 @@ export default { |
| 59 | 59 | trigger: 'axis', |
| 60 | 60 | formatter: (data)=>{ |
| 61 | 61 | console.log(data) |
| 62 | - return moment(data[0].data[0]).format("HH:mm:ss") + "</br> 使用:" + (data[0].data[1]*100).toFixed(2) + "%"; | |
| 62 | + return moment(data[0].data[0]).format("HH:mm:ss") + "</br> " | |
| 63 | + + data[0].marker + "使用:" + (data[0].data[1]*100).toFixed(2) + "%"; | |
| 63 | 64 | } |
| 64 | 65 | }, |
| 65 | 66 | series: { |
| ... | ... | @@ -85,13 +86,16 @@ export default { |
| 85 | 86 | } |
| 86 | 87 | }; |
| 87 | 88 | }, |
| 89 | + created() { | |
| 90 | + | |
| 91 | + | |
| 92 | + }, | |
| 88 | 93 | mounted() { |
| 89 | - // setInterval(()=>{ | |
| 90 | - // // console.log(111111) | |
| 91 | - // for (let i = 0; i < this.chartData.rows.length; i++) { | |
| 92 | - // this.chartData.rows[i].销售额 += 1000; | |
| 93 | - // } | |
| 94 | - // },1000) | |
| 94 | + this.$nextTick(_ => { | |
| 95 | + setTimeout(()=>{ | |
| 96 | + this.$refs.consoleCPU.echarts.resize() | |
| 97 | + }, 100) | |
| 98 | + }) | |
| 95 | 99 | }, |
| 96 | 100 | destroyed() { |
| 97 | 101 | }, | ... | ... |
web_src/src/components/console/ConsoleDisk.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div id="ConsoleNet" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> | |
| 3 | + <ve-bar ref="ConsoleNet" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-bar> | |
| 4 | + </div> | |
| 5 | +</template> | |
| 6 | + | |
| 7 | +<script> | |
| 8 | + | |
| 9 | + | |
| 10 | +import moment from "moment/moment"; | |
| 11 | + | |
| 12 | +export default { | |
| 13 | + name: 'ConsoleNet', | |
| 14 | + data() { | |
| 15 | + return { | |
| 16 | + chartData: { | |
| 17 | + columns: ['path','free','use'], | |
| 18 | + rows: [] | |
| 19 | + }, | |
| 20 | + chartSettings: { | |
| 21 | + stack: { | |
| 22 | + 'xxx': ['free', 'use'] | |
| 23 | + }, | |
| 24 | + labelMap: { | |
| 25 | + 'free': '剩余', | |
| 26 | + 'use': '已使用' | |
| 27 | + }, | |
| 28 | + }, | |
| 29 | + extend: { | |
| 30 | + title: { | |
| 31 | + show: true, | |
| 32 | + text: "磁盘", | |
| 33 | + left: "center", | |
| 34 | + top: 20, | |
| 35 | + }, | |
| 36 | + grid: { | |
| 37 | + show: true, | |
| 38 | + right: "30px", | |
| 39 | + containLabel: true, | |
| 40 | + }, | |
| 41 | + series: { | |
| 42 | + barWidth: 30 | |
| 43 | + }, | |
| 44 | + legend: { | |
| 45 | + left: "center", | |
| 46 | + bottom: "15px", | |
| 47 | + }, | |
| 48 | + tooltip: { | |
| 49 | + trigger: 'axis', | |
| 50 | + formatter: (data)=>{ | |
| 51 | + console.log(data) | |
| 52 | + let relVal = ""; | |
| 53 | + for (let i = 0; i < data.length; i++) { | |
| 54 | + relVal += data[i].marker + data[i].seriesName + ":" + data[i].value.toFixed(2) + "GB" | |
| 55 | + if (i < data.length - 1) { | |
| 56 | + relVal += "</br>"; | |
| 57 | + } | |
| 58 | + } | |
| 59 | + return relVal; | |
| 60 | + } | |
| 61 | + }, | |
| 62 | + | |
| 63 | + } | |
| 64 | + }; | |
| 65 | + }, | |
| 66 | + mounted() { | |
| 67 | + this.$nextTick(_ => { | |
| 68 | + setTimeout(()=>{ | |
| 69 | + this.$refs.ConsoleNet.echarts.resize() | |
| 70 | + }, 100) | |
| 71 | + }) | |
| 72 | + }, | |
| 73 | + destroyed() { | |
| 74 | + }, | |
| 75 | + methods: { | |
| 76 | + setData: function(data) { | |
| 77 | + this.chartData.rows = data; | |
| 78 | + } | |
| 79 | + } | |
| 80 | +}; | |
| 81 | +</script> | ... | ... |
web_src/src/components/console/ConsoleMEM.vue
| 1 | 1 | <template> |
| 2 | 2 | <div id="ConsoleMEM" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> |
| 3 | - <ve-line :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line> | |
| 3 | + <ve-line ref="ConsoleMEM" :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line> | |
| 4 | 4 | </div> |
| 5 | 5 | </template> |
| 6 | 6 | |
| ... | ... | @@ -59,7 +59,7 @@ export default { |
| 59 | 59 | trigger: 'axis', |
| 60 | 60 | formatter: (data)=>{ |
| 61 | 61 | console.log(data) |
| 62 | - return moment(data[0].data[0]).format("HH:mm:ss") + "</br> 使用:" + (data[0].data[1]*100).toFixed(2) + "%"; | |
| 62 | + return moment(data[0].data[0]).format("HH:mm:ss") + "</br>"+ data[0].marker +" 使用:" + (data[0].data[1]*100).toFixed(2) + "%"; | |
| 63 | 63 | } |
| 64 | 64 | }, |
| 65 | 65 | series: { |
| ... | ... | @@ -86,12 +86,11 @@ export default { |
| 86 | 86 | }; |
| 87 | 87 | }, |
| 88 | 88 | mounted() { |
| 89 | - // setInterval(()=>{ | |
| 90 | - // // console.log(111111) | |
| 91 | - // for (let i = 0; i < this.chartData.rows.length; i++) { | |
| 92 | - // this.chartData.rows[i].销售额 += 1000; | |
| 93 | - // } | |
| 94 | - // },1000) | |
| 89 | + this.$nextTick(_ => { | |
| 90 | + setTimeout(()=>{ | |
| 91 | + this.$refs.ConsoleMEM.echarts.resize() | |
| 92 | + }, 100) | |
| 93 | + }) | |
| 95 | 94 | }, |
| 96 | 95 | destroyed() { |
| 97 | 96 | }, |
| ... | ... | @@ -99,7 +98,6 @@ export default { |
| 99 | 98 | setData: function(data) { |
| 100 | 99 | this.chartData .rows = data; |
| 101 | 100 | } |
| 102 | - | |
| 103 | 101 | } |
| 104 | 102 | }; |
| 105 | 103 | </script> | ... | ... |
web_src/src/components/console/ConsoleMediaServer.vue
| 1 | 1 | <template> |
| 2 | 2 | <div id="ConsoleMediaServer" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> |
| 3 | - <ve-histogram :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-histogram> | |
| 3 | + <ve-histogram ref="ConsoleMEM" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-histogram> | |
| 4 | 4 | </div> |
| 5 | 5 | </template> |
| 6 | 6 | |
| ... | ... | @@ -66,12 +66,11 @@ export default { |
| 66 | 66 | }; |
| 67 | 67 | }, |
| 68 | 68 | mounted() { |
| 69 | - // setInterval(()=>{ | |
| 70 | - // // console.log(111111) | |
| 71 | - // for (let i = 0; i < this.chartData.rows.length; i++) { | |
| 72 | - // this.chartData.rows[i].销售额 += 1000; | |
| 73 | - // } | |
| 74 | - // },1000) | |
| 69 | + this.$nextTick(_ => { | |
| 70 | + setTimeout(()=>{ | |
| 71 | + this.$refs.ConsoleMEM.echarts.resize() | |
| 72 | + }, 100) | |
| 73 | + }) | |
| 75 | 74 | }, |
| 76 | 75 | destroyed() { |
| 77 | 76 | }, | ... | ... |
web_src/src/components/console/ConsoleNet.vue
| 1 | 1 | <template> |
| 2 | 2 | <div id="ConsoleNet" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> |
| 3 | - <ve-line :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-line> | |
| 3 | + <ve-line ref="ConsoleNet" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-line> | |
| 4 | 4 | </div> |
| 5 | 5 | </template> |
| 6 | 6 | |
| ... | ... | @@ -14,7 +14,7 @@ export default { |
| 14 | 14 | data() { |
| 15 | 15 | return { |
| 16 | 16 | chartData: { |
| 17 | - columns: ['time', 'in', 'out'], | |
| 17 | + columns: ['time','out','in'], | |
| 18 | 18 | rows: [] |
| 19 | 19 | }, |
| 20 | 20 | chartSettings: { |
| ... | ... | @@ -48,13 +48,18 @@ export default { |
| 48 | 48 | showMaxLabel: true, |
| 49 | 49 | }, |
| 50 | 50 | }, |
| 51 | + yAxis: { | |
| 52 | + type: 'value', | |
| 53 | + min: 0, | |
| 54 | + max: 1000, | |
| 55 | + splitNumber: 6, | |
| 56 | + position: "left", | |
| 57 | + silent: true, | |
| 58 | + }, | |
| 51 | 59 | tooltip: { |
| 52 | 60 | trigger: 'axis', |
| 53 | 61 | formatter: (data)=>{ |
| 54 | - console.log(parseFloat(data[0].data[1]).toFixed(2)) | |
| 55 | - console.log(parseFloat(data[1].data[1]).toFixed(2)) | |
| 56 | - console.log("############") | |
| 57 | - return "下载:" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps" + "</br> 上传:" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps"; | |
| 62 | + return data[1].marker + "下载:" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps" + "</br> "+ data[0].marker +" 上传:" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps"; | |
| 58 | 63 | } |
| 59 | 64 | }, |
| 60 | 65 | legend: { |
| ... | ... | @@ -65,19 +70,18 @@ export default { |
| 65 | 70 | }; |
| 66 | 71 | }, |
| 67 | 72 | mounted() { |
| 68 | - // setInterval(()=>{ | |
| 69 | - // // console.log(111111) | |
| 70 | - // for (let i = 0; i < this.chartData.rows.length; i++) { | |
| 71 | - // this.chartData.rows[i].销售额 += 1000; | |
| 72 | - // } | |
| 73 | - // },1000) | |
| 73 | + this.$nextTick(_ => { | |
| 74 | + setTimeout(()=>{ | |
| 75 | + this.$refs.ConsoleNet.echarts.resize() | |
| 76 | + }, 100) | |
| 77 | + }) | |
| 74 | 78 | }, |
| 75 | 79 | destroyed() { |
| 76 | 80 | }, |
| 77 | 81 | methods: { |
| 78 | - setData: function(data) { | |
| 79 | - console.log(data) | |
| 82 | + setData: function(data, total) { | |
| 80 | 83 | this.chartData .rows = data; |
| 84 | + this.extend.yAxis.max= total; | |
| 81 | 85 | } |
| 82 | 86 | |
| 83 | 87 | } | ... | ... |
web_src/src/components/console/ConsoleNodeLoad.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div id="ConsoleNodeLoad" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> | |
| 3 | + <ve-histogram ref="consoleNodeLoad" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" :legend-visible="true"></ve-histogram> | |
| 4 | + </div> | |
| 5 | +</template> | |
| 6 | + | |
| 7 | +<script> | |
| 8 | + | |
| 9 | + | |
| 10 | +import moment from "moment/moment"; | |
| 11 | + | |
| 12 | +export default { | |
| 13 | + name: 'ConsoleNodeLoad', | |
| 14 | + data() { | |
| 15 | + return { | |
| 16 | + chartData: { | |
| 17 | + columns: ['id', 'push', 'proxy', 'gbReceive', 'gbSend'], | |
| 18 | + rows: [] | |
| 19 | + }, | |
| 20 | + chartSettings: { | |
| 21 | + labelMap: { | |
| 22 | + 'push': '直播推流', | |
| 23 | + 'proxy': '拉流代理', | |
| 24 | + 'gbReceive': '国标收流', | |
| 25 | + 'gbSend': '国标推流', | |
| 26 | + }, | |
| 27 | + }, | |
| 28 | + extend: { | |
| 29 | + title: { | |
| 30 | + show: true, | |
| 31 | + text: "节点负载", | |
| 32 | + left: "center", | |
| 33 | + top: 20, | |
| 34 | + | |
| 35 | + }, | |
| 36 | + legend: { | |
| 37 | + left: "center", | |
| 38 | + bottom: "15px", | |
| 39 | + }, | |
| 40 | + label: { | |
| 41 | + show: true, | |
| 42 | + position: "top" | |
| 43 | + } | |
| 44 | + } | |
| 45 | + }; | |
| 46 | + }, | |
| 47 | + mounted() { | |
| 48 | + this.$nextTick(_ => { | |
| 49 | + setTimeout(()=>{ | |
| 50 | + this.$refs.consoleNodeLoad.echarts.resize() | |
| 51 | + }, 100) | |
| 52 | + }) | |
| 53 | + }, | |
| 54 | + destroyed() { | |
| 55 | + }, | |
| 56 | + methods: { | |
| 57 | + setData: function(data) { | |
| 58 | + this.chartData .rows = data; | |
| 59 | + } | |
| 60 | + | |
| 61 | + } | |
| 62 | +}; | |
| 63 | +</script> | ... | ... |
web_src/src/components/console/ConsoleResource.vue
0 → 100644
| 1 | +<template > | |
| 2 | + <div id="consoleResource" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center"> | |
| 3 | + <div style="width: 50%;height: 50%; float:left; "> | |
| 4 | + <el-progress :width="100" :stroke-width="8" type="circle" :percentage="deviceInfo.online/deviceInfo.total*100" style="margin-top: 20px; font-size: 18px"></el-progress> | |
| 5 | + <div class="resourceInfo"> | |
| 6 | + 设备总数:{{deviceInfo.total}}<br/> | |
| 7 | + 在线数:{{deviceInfo.online}} | |
| 8 | + </div> | |
| 9 | + </div> | |
| 10 | + <div style="width: 50%;height: 50%; float:left; "> | |
| 11 | + <el-progress :width="100" :stroke-width="10" type="circle" :percentage="channelInfo.online/channelInfo.total*100" style="margin-top: 20px"></el-progress> | |
| 12 | + <div class="resourceInfo"> | |
| 13 | + 通道总数:{{channelInfo.total}}<br/> | |
| 14 | + 在线数:{{channelInfo.online}} | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + <div style="width: 50%;height: 50%; float:left; "> | |
| 18 | + <el-progress :width="100" :stroke-width="10" type="circle" :percentage="pushInfo.online/pushInfo.total*100" style="margin-top: 20px"></el-progress> | |
| 19 | + <div class="resourceInfo"> | |
| 20 | + 推流总数:{{pushInfo.total}}<br/> | |
| 21 | + 在线数:{{pushInfo.online}} | |
| 22 | + </div> | |
| 23 | + </div> | |
| 24 | + <div style="width: 50%;height: 50%; float:left; "> | |
| 25 | + <el-progress :width="100" :stroke-width="10" type="circle" :percentage="proxyInfo.online/proxyInfo.total*100" style="margin-top: 20px"></el-progress> | |
| 26 | + <div class="resourceInfo"> | |
| 27 | + 拉流代理总数:{{proxyInfo.total}}<br/> | |
| 28 | + 在线数:{{proxyInfo.online}} | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | +</template> | |
| 33 | + | |
| 34 | +<script> | |
| 35 | + | |
| 36 | +export default { | |
| 37 | + name: 'consoleResource', | |
| 38 | + data() { | |
| 39 | + return { | |
| 40 | + deviceInfo: { | |
| 41 | + total: 0, | |
| 42 | + online: 0 | |
| 43 | + }, | |
| 44 | + channelInfo: { | |
| 45 | + total: 0, | |
| 46 | + online: 0 | |
| 47 | + }, | |
| 48 | + pushInfo: { | |
| 49 | + total: 0, | |
| 50 | + online: 0 | |
| 51 | + }, | |
| 52 | + proxyInfo: { | |
| 53 | + total: 0, | |
| 54 | + online: 0 | |
| 55 | + }, | |
| 56 | + }; | |
| 57 | + }, | |
| 58 | + created() { | |
| 59 | + | |
| 60 | + | |
| 61 | + }, | |
| 62 | + mounted() { | |
| 63 | + }, | |
| 64 | + destroyed() { | |
| 65 | + }, | |
| 66 | + methods: { | |
| 67 | + setData: function(data) { | |
| 68 | + this.deviceInfo = data.device; | |
| 69 | + this.channelInfo = data.channel; | |
| 70 | + this.pushInfo = data.push; | |
| 71 | + this.proxyInfo = data.proxy; | |
| 72 | + } | |
| 73 | + } | |
| 74 | +}; | |
| 75 | +</script> | |
| 76 | + | |
| 77 | +<style> | |
| 78 | +.resourceInfo{ | |
| 79 | + width: 100%; | |
| 80 | + text-align: center; | |
| 81 | + font-size: 12px | |
| 82 | +} | |
| 83 | +.el-progress__text { | |
| 84 | + font-size: 18px !important; | |
| 85 | +} | |
| 86 | +</style> | ... | ... |
web_src/src/layout/UiHeader.vue
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#001529" text-color="#fff" |
| 5 | 5 | active-text-color="#1890ff" mode="horizontal"> |
| 6 | 6 | |
| 7 | - <el-menu-item index="/control">控制台</el-menu-item> | |
| 7 | + <el-menu-item index="/console">控制台</el-menu-item> | |
| 8 | 8 | <el-menu-item index="/live">分屏监控</el-menu-item> |
| 9 | 9 | <el-menu-item index="/deviceList">国标设备</el-menu-item> |
| 10 | 10 | <el-menu-item index="/map">电子地图</el-menu-item> | ... | ... |