首页改造完成,待添加系统信息
parent
3ffe205082
commit
ca891f367c
|
@ -8,6 +8,10 @@ public class SystemAllInfo {
|
|||
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 class SystemAllInfo {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -27,11 +27,9 @@ public class VideoManagerConstants {
|
|||
|
||||
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 class VideoManagerConstants {
|
|||
|
||||
public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
|
||||
|
||||
public static final String SYSTEM_INFO_DISK_PREFIX = "VMP_SYSTEM_INFO_DISK_";
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -31,6 +32,8 @@ public class SystemInfoTimerTask {
|
|||
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());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service;
|
|||
|
||||
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 @@ public interface IDeviceChannelService {
|
|||
*/
|
||||
int updateChannels(String deviceId, List<DeviceChannel> channels);
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
* @return
|
||||
*/
|
||||
ResourceBaceInfo getOverview();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
|||
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 @@ public interface IDeviceService {
|
|||
* @return
|
||||
*/
|
||||
boolean delete(String deviceId);
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
* @return
|
||||
*/
|
||||
ResourceBaceInfo getOverview();
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONObject;
|
|||
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 @@ public interface IMediaServerService {
|
|||
void updateMediaServerKeepalive(String mediaServerId, JSONObject data);
|
||||
|
||||
boolean checkRtpServer(MediaServerItem mediaServerItem, String rtp, String stream);
|
||||
|
||||
/**
|
||||
* 获取负载信息
|
||||
* @return
|
||||
*/
|
||||
MediaServerLoad getLoad(MediaServerItem mediaServerItem);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
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 @@ public interface IStreamProxyService {
|
|||
* 更新代理流
|
||||
*/
|
||||
boolean updateStreamProxy(StreamProxyItem streamProxyItem);
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
* @return
|
||||
*/
|
||||
ResourceBaceInfo getOverview();
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
|||
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 @@ public interface IStreamPushService {
|
|||
* @return
|
||||
*/
|
||||
List<String> getAllAppAndStream();
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
* @return
|
||||
*/
|
||||
ResourceBaceInfo getOverview();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|||
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 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
|||
}
|
||||
return addChannels.size() + updateChannels.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return channelMapper.getOverview();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
|||
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 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return deviceMapper.getOverview();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import java.util.Set;
|
|||
|
||||
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;
|
||||
|
@ -90,6 +92,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
@Autowired
|
||||
private DynamicTask dynamicTask;
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
|
@ -691,4 +696,15 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
|||
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 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return streamProxyMapper.getOverview();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
|||
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 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
|
||||
@Override
|
||||
public List<String> getAllAppAndStream() {
|
||||
|
||||
return streamPushMapper.getAllAppAndStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return streamPushMapper.getOverview(userSetting.isUsePushingAsStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -244,4 +244,16 @@ public interface IRedisCatchStorage {
|
|||
|
||||
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();
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
|
|||
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 @@ public interface DeviceChannelMapper {
|
|||
|
||||
@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();
|
||||
}
|
||||
|
|
|
@ -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 @@ public interface DeviceMapper {
|
|||
"#{online}" +
|
||||
")")
|
||||
void addCustomDevice(Device device);
|
||||
|
||||
@Select("select count(1) as total, sum(online) as online from device")
|
||||
ResourceBaceInfo getOverview();
|
||||
|
||||
}
|
||||
|
|
|
@ -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 @@ public interface StreamProxyMapper {
|
|||
|
||||
@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();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
|
|||
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 @@ public interface StreamPushMapper {
|
|||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|||
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.IRedisCatchStorage;
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
*/
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
*/
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某个通道是否存在上级点播(RTP推送)
|
||||
|
@ -483,7 +518,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
*/
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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,
|
||||
|
@ -739,15 +776,26 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
}
|
||||
}
|
||||
|
||||
@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 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class GitUtil {
|
|||
|
||||
@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;
|
||||
|
|
|
@ -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 @@ public class SystemInfoUtils {
|
|||
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 @@ public class SystemInfoUtils {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -12,10 +12,13 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
|||
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 org.springframework.web.bind.annotation.*;
|
|||
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 = "服务控制")
|
||||
|
@ -55,6 +57,20 @@ public class ServerController {
|
|||
@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 @@ public class ServerController {
|
|||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 uiHeader from '../layout/UiHeader.vue'
|
|||
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 @@ export default {
|
|||
uiHeader,
|
||||
consoleCPU,
|
||||
consoleMem,
|
||||
consoleNet
|
||||
consoleNet,
|
||||
consoleNodeLoad,
|
||||
consoleDisk,
|
||||
consoleResource,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -76,7 +85,10 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.getSystemInfo();
|
||||
this.getLoad();
|
||||
this.getResourceInfo();
|
||||
this.loopForSystemInfo();
|
||||
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
|
@ -87,8 +99,10 @@ export default {
|
|||
}
|
||||
this.timer = setTimeout(()=>{
|
||||
this.getSystemInfo();
|
||||
this.getLoad();
|
||||
this.timer = null;
|
||||
this.loopForSystemInfo()
|
||||
this.getResourceInfo()
|
||||
}, 2000)
|
||||
},
|
||||
getSystemInfo: function (){
|
||||
|
@ -99,11 +113,38 @@ export default {
|
|||
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>
|
||||
|
|
|
@ -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 @@ export default {
|
|||
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: {
|
||||
|
@ -84,14 +85,17 @@ export default {
|
|||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
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() {
|
||||
},
|
||||
|
|
|
@ -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>
|
|
@ -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 @@ export default {
|
|||
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 @@ export default {
|
|||
};
|
||||
},
|
||||
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 @@ export default {
|
|||
setData: function(data) {
|
||||
this.chartData .rows = data;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -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 @@ export default {
|
|||
};
|
||||
},
|
||||
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() {
|
||||
},
|
||||
|
|
|
@ -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 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
chartData: {
|
||||
columns: ['time', 'in', 'out'],
|
||||
columns: ['time','out','in'],
|
||||
rows: []
|
||||
},
|
||||
chartSettings: {
|
||||
|
@ -48,13 +48,18 @@ export default {
|
|||
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 @@ export default {
|
|||
};
|
||||
},
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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': '拉流代理',
|
||||
'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>
|
|
@ -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">
|
||||
拉流代理总数:{{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>
|
|
@ -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>
|
||||
|
|
|
@ -24,6 +24,9 @@ export default {
|
|||
}
|
||||
</script>
|
||||
<style>
|
||||
body{
|
||||
font-family: sans-serif;
|
||||
}
|
||||
/*定义标题栏*/
|
||||
.page-header {
|
||||
background-color: #FFFFFF;
|
||||
|
|
Loading…
Reference in New Issue