| | |
| | | private List<Object> mem; |
| | | private List<Object> net; |
| | | |
| | | private long netTotal; |
| | | |
| | | private Object disk; |
| | | |
| | | public List<Object> getCpu() { |
| | | return cpu; |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | |
|
| | | 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_";
|
| | |
| | |
|
| | | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
|
| | |
|
| | | public static final String SYSTEM_INFO_DISK_PREFIX = "VMP_SYSTEM_INFO_DISK_";
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | 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()); |
| | | } |
New file |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | int updateChannels(String deviceId, List<DeviceChannel> channels); |
| | | |
| | | /** |
| | | * 获取统计信息 |
| | | * @return |
| | | */ |
| | | ResourceBaceInfo getOverview(); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | boolean delete(String deviceId); |
| | | |
| | | /** |
| | | * 获取统计信息 |
| | | * @return |
| | | */ |
| | | ResourceBaceInfo getOverview(); |
| | | |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 媒体服务节点 |
| | |
| | | void updateMediaServerKeepalive(String mediaServerId, JSONObject data); |
| | | |
| | | boolean checkRtpServer(MediaServerItem mediaServerItem, String rtp, String stream); |
| | | |
| | | /** |
| | | * 获取负载信息 |
| | | * @return |
| | | */ |
| | | MediaServerLoad getLoad(MediaServerItem mediaServerItem); |
| | | } |
| | |
| | | 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 { |
| | |
| | | * 更新代理流 |
| | | */ |
| | | boolean updateStreamProxy(StreamProxyItem streamProxyItem); |
| | | |
| | | /** |
| | | * 获取统计信息 |
| | | * @return |
| | | */ |
| | | ResourceBaceInfo getOverview(); |
| | | |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<String> getAllAppAndStream(); |
| | | |
| | | /** |
| | | * 获取统计信息 |
| | | * @return |
| | | */ |
| | | ResourceBaceInfo getOverview(); |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | return addChannels.size() + updateChannels.size(); |
| | | } |
| | | |
| | | @Override |
| | | public ResourceBaceInfo getOverview() { |
| | | return channelMapper.getOverview(); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public ResourceBaceInfo getOverview() { |
| | | return deviceMapper.getOverview(); |
| | | } |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private DynamicTask dynamicTask; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | /** |
| | | * 初始化 |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public ResourceBaceInfo getOverview() { |
| | | return streamProxyMapper.getOverview(); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | @Override |
| | | public List<String> getAllAppAndStream() { |
| | | |
| | | return streamPushMapper.getAllAppAndStream(); |
| | | } |
| | | |
| | | @Override |
| | | public ResourceBaceInfo getOverview() { |
| | | return streamPushMapper.getOverview(userSetting.isUsePushingAsStatus()); |
| | | } |
| | | } |
| | |
| | | |
| | | 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(); |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | @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(); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | "#{online}" + |
| | | ")") |
| | | void addCustomDevice(Device device); |
| | | |
| | | @Select("select count(1) as total, sum(online) as online from device") |
| | | ResourceBaceInfo getOverview(); |
| | | |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | |
| | | @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(); |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | @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); |
| | | } |
| | |
| | | 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.*; |
| | |
| | | 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; |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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())); |
| | |
| | | */ |
| | | @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; |
| | | } |
| | |
| | | |
| | | @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)); |
| | |
| | | @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; |
| | | } |
| | |
| | | |
| | | @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; |
| | | } |
| | |
| | | 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, |
| | |
| | | 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, |
| | |
| | | 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, |
| | |
| | | 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, |
| | |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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)); |
| | |
| | | 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) { |
| | |
| | | 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) { |
| | |
| | | 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<>(); |
| | | |
| | |
| | | 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) { |
| | |
| | | } |
| | | } |
| | | |
| | | @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推送) |
| | |
| | | */ |
| | | @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; |
| | |
| | | } |
| | | } |
| | | |
| | | 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) { |
| | |
| | | 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, |
| | |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | } |
| | | } |
| | |
| | | |
| | | @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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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 = "服务控制") |
| | |
| | | |
| | | @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; |
| | |
| | | @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; |
| | | } |
| | | } |
| | |
| | | <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 }" > |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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'; |
| | | |
| | |
| | | uiHeader, |
| | | consoleCPU, |
| | | consoleMem, |
| | | consoleNet |
| | | consoleNet, |
| | | consoleNodeLoad, |
| | | consoleDisk, |
| | | consoleResource, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | created() { |
| | | this.getSystemInfo(); |
| | | this.getLoad(); |
| | | this.getResourceInfo(); |
| | | this.loopForSystemInfo(); |
| | | |
| | | }, |
| | | destroyed() { |
| | | }, |
| | |
| | | } |
| | | this.timer = setTimeout(()=>{ |
| | | this.getSystemInfo(); |
| | | this.getLoad(); |
| | | this.timer = null; |
| | | this.loopForSystemInfo() |
| | | this.getResourceInfo() |
| | | }, 2000) |
| | | }, |
| | | getSystemInfo: function (){ |
| | |
| | | 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> |
| | |
| | | <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> |
| | | |
| | |
| | | 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: { |
| | |
| | | } |
| | | }; |
| | | }, |
| | | 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() { |
| | | }, |
New file |
| | |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | 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: { |
| | |
| | | }; |
| | | }, |
| | | 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() { |
| | | }, |
| | |
| | | setData: function(data) { |
| | | this.chartData .rows = data; |
| | | } |
| | | |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | <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> |
| | | |
| | |
| | | }; |
| | | }, |
| | | 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() { |
| | | }, |
| | |
| | | <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> |
| | | |
| | |
| | | data() { |
| | | return { |
| | | chartData: { |
| | | columns: ['time', 'in', 'out'], |
| | | columns: ['time','out','in'], |
| | | rows: [] |
| | | }, |
| | | chartSettings: { |
| | |
| | | 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: { |
| | |
| | | }; |
| | | }, |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <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> |
New file |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | } |
| | | </script> |
| | | <style> |
| | | body{ |
| | | font-family: sans-serif; |
| | | } |
| | | /*定义标题栏*/ |
| | | .page-header { |
| | | background-color: #FFFFFF; |