完成linux系统下内存信息、磁盘信息获取
This commit is contained in:
parent
8661aca703
commit
fe2a1c792b
@ -1,4 +1,5 @@
|
|||||||
using Infrastructure.Extensions;
|
using Infrastructure.Extensions;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -19,19 +20,20 @@ namespace Infrastructure
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
MemoryMetricsClient client = new();
|
MemoryMetricsClient client = new();
|
||||||
MemoryMetrics memoryMetrics = client.GetMetrics();
|
MemoryMetrics memoryMetrics = IsUnix() ? client.GetUnixMetrics() : client.GetWindowsMetrics();
|
||||||
memoryMetrics.FreeRam = Math.Ceiling(memoryMetrics.Free / 1024) + "GB";
|
|
||||||
memoryMetrics.UsedRam = Math.Ceiling(memoryMetrics.Used / 1024) + "GB";
|
memoryMetrics.FreeRam = Math.Round(memoryMetrics.Free / 1024, 2) + "GB";
|
||||||
memoryMetrics.TotalRAM = Math.Ceiling(memoryMetrics.Total / 1024).ToString() + " GB";
|
memoryMetrics.UsedRam = Math.Round(memoryMetrics.Used / 1024, 2) + "GB";
|
||||||
|
memoryMetrics.TotalRAM = Math.Round(memoryMetrics.Total / 1024, 2) + "GB";
|
||||||
memoryMetrics.RAMRate = Math.Ceiling(100 * memoryMetrics.Used / memoryMetrics.Total).ToString() + "%";
|
memoryMetrics.RAMRate = Math.Ceiling(100 * memoryMetrics.Used / memoryMetrics.Total).ToString() + "%";
|
||||||
memoryMetrics.CPURate = Math.Ceiling(GetCPURate().ParseToDouble()) + "%";
|
memoryMetrics.CPURate = Math.Ceiling(GetCPURate().ParseToDouble()) + "%";
|
||||||
return memoryMetrics;
|
return memoryMetrics;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
Console.WriteLine("获取内存使用出错,msg=" + ex.Message + "," + ex.StackTrace);
|
||||||
}
|
}
|
||||||
return null;
|
return new MemoryMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,20 +44,52 @@ namespace Infrastructure
|
|||||||
{
|
{
|
||||||
List<DiskInfo> diskInfos = new();
|
List<DiskInfo> diskInfos = new();
|
||||||
|
|
||||||
var driv = DriveInfo.GetDrives();
|
if (IsUnix())
|
||||||
foreach (var item in driv)
|
|
||||||
{
|
{
|
||||||
var obj = new DiskInfo()
|
try
|
||||||
{
|
{
|
||||||
DickName = item.Name,
|
string output = ShellHelper.Bash("df -m / | awk '{print $2,$3,$4,$5,$6}'");
|
||||||
TypeName = item.DriveType.ToString(),
|
var arr = output.Split('\n', StringSplitOptions.RemoveEmptyEntries);
|
||||||
TotalFree = item.TotalFreeSpace / 1024 / 1024 / 1024,
|
if (arr.Length == 0) return diskInfos;
|
||||||
TotalSize = item.TotalSize / 1024 / 1024 / 1024,
|
|
||||||
AvailableFreeSpace = item.AvailableFreeSpace / 1024 / 1024 / 1024,
|
var rootDisk = arr[1].Split(' ', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||||
};
|
if (rootDisk == null || rootDisk.Length == 0)
|
||||||
obj.AvailablePercent = decimal.Ceiling(((decimal)(obj.TotalSize - obj.AvailableFreeSpace) /(decimal)obj.TotalSize) * 100);
|
{
|
||||||
diskInfos.Add(obj);
|
return diskInfos;
|
||||||
|
}
|
||||||
|
DiskInfo diskInfo = new()
|
||||||
|
{
|
||||||
|
DiskName = "/",
|
||||||
|
TotalSize = long.Parse(rootDisk[0]) / 1024,
|
||||||
|
Used = long.Parse(rootDisk[1]) / 1024,
|
||||||
|
AvailableFreeSpace = long.Parse(rootDisk[2]) / 1024,
|
||||||
|
AvailablePercent = decimal.Parse(rootDisk[3].Replace("%", ""))
|
||||||
|
};
|
||||||
|
diskInfos.Add(diskInfo);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("获取磁盘信息出错了" + ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var driv = DriveInfo.GetDrives();
|
||||||
|
foreach (var item in driv)
|
||||||
|
{
|
||||||
|
var obj = new DiskInfo()
|
||||||
|
{
|
||||||
|
DiskName = item.Name,
|
||||||
|
TypeName = item.DriveType.ToString(),
|
||||||
|
TotalSize = item.TotalSize / 1024 / 1024 / 1024,
|
||||||
|
AvailableFreeSpace = item.AvailableFreeSpace / 1024 / 1024 / 1024,
|
||||||
|
};
|
||||||
|
obj.Used = obj.TotalSize - obj.AvailableFreeSpace;
|
||||||
|
obj.AvailablePercent = decimal.Ceiling(obj.Used / (decimal)obj.TotalSize * 100);
|
||||||
|
diskInfos.Add(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return diskInfos;
|
return diskInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +115,10 @@ namespace Infrastructure
|
|||||||
return cpuRate;
|
return cpuRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取系统运行时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static string GetRunTime()
|
public static string GetRunTime()
|
||||||
{
|
{
|
||||||
string runTime = string.Empty;
|
string runTime = string.Empty;
|
||||||
@ -88,8 +126,7 @@ namespace Infrastructure
|
|||||||
{
|
{
|
||||||
if (IsUnix())
|
if (IsUnix())
|
||||||
{
|
{
|
||||||
string output = ShellHelper.Bash("uptime -s");
|
string output = ShellHelper.Bash("uptime -s").Trim();
|
||||||
output = output.Trim();
|
|
||||||
runTime = DateTimeHelper.FormatTime((DateTime.Now - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong());
|
runTime = DateTimeHelper.FormatTime((DateTime.Now - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -104,7 +141,7 @@ namespace Infrastructure
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
Console.WriteLine("获取runTime出错" + ex.Message);
|
||||||
}
|
}
|
||||||
return runTime;
|
return runTime;
|
||||||
}
|
}
|
||||||
@ -115,8 +152,11 @@ namespace Infrastructure
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MemoryMetrics
|
public class MemoryMetrics
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
public double Total { get; set; }
|
public double Total { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
public double Used { get; set; }
|
public double Used { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
public double Free { get; set; }
|
public double Free { get; set; }
|
||||||
|
|
||||||
public string UsedRam { get; set; }
|
public string UsedRam { get; set; }
|
||||||
@ -143,11 +183,15 @@ namespace Infrastructure
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 磁盘名
|
/// 磁盘名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DickName { get; set; }
|
public string DiskName { get; set; }
|
||||||
public string TypeName { get; set; }
|
public string TypeName { get; set; }
|
||||||
public long TotalFree { get; set; }
|
public long TotalFree { get; set; }
|
||||||
public long TotalSize { get; set; }
|
public long TotalSize { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 已使用
|
||||||
|
/// </summary>
|
||||||
|
public long Used { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 可使用
|
/// 可使用
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long AvailableFreeSpace { get; set; }
|
public long AvailableFreeSpace { get; set; }
|
||||||
@ -156,63 +200,54 @@ namespace Infrastructure
|
|||||||
|
|
||||||
public class MemoryMetricsClient
|
public class MemoryMetricsClient
|
||||||
{
|
{
|
||||||
public MemoryMetrics GetMetrics()
|
#region 获取内存信息
|
||||||
{
|
|
||||||
if (ComputerHelper.IsUnix())
|
|
||||||
{
|
|
||||||
return GetUnixMetrics();
|
|
||||||
}
|
|
||||||
return GetWindowsMetrics();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// windows系统获取内存信息
|
/// windows系统获取内存信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private MemoryMetrics GetWindowsMetrics()
|
public MemoryMetrics GetWindowsMetrics()
|
||||||
{
|
{
|
||||||
string output = ShellHelper.Cmd("wmic", "OS get FreePhysicalMemory,TotalVisibleMemorySize /Value");
|
string output = ShellHelper.Cmd("wmic", "OS get FreePhysicalMemory,TotalVisibleMemorySize /Value");
|
||||||
|
var metrics = new MemoryMetrics();
|
||||||
|
var lines = output.Trim().Split('\n', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
|
if (lines.Length <= 0) return metrics;
|
||||||
|
|
||||||
var lines = output.Trim().Split('\n');
|
|
||||||
var freeMemoryParts = lines[0].Split('=', (char)StringSplitOptions.RemoveEmptyEntries);
|
var freeMemoryParts = lines[0].Split('=', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||||
var totalMemoryParts = lines[1].Split('=', (char)StringSplitOptions.RemoveEmptyEntries);
|
var totalMemoryParts = lines[1].Split('=', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
var metrics = new MemoryMetrics();
|
|
||||||
metrics.Total = Math.Round(double.Parse(totalMemoryParts[1]) / 1024, 0);
|
metrics.Total = Math.Round(double.Parse(totalMemoryParts[1]) / 1024, 0);
|
||||||
metrics.Free = Math.Round(double.Parse(freeMemoryParts[1]) / 1024, 0);
|
metrics.Free = Math.Round(double.Parse(freeMemoryParts[1]) / 1024, 0);//m
|
||||||
metrics.Used = metrics.Total - metrics.Free;
|
metrics.Used = metrics.Total - metrics.Free;
|
||||||
|
|
||||||
return metrics;
|
return metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// windows 获取磁盘信息
|
|
||||||
/// </summary>
|
|
||||||
private void GetWindowsDiskInfo()
|
|
||||||
{
|
|
||||||
string output = ShellHelper.Cmd("wmic", "diskdrive get Size /Value");
|
|
||||||
|
|
||||||
Console.WriteLine(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unix系统获取
|
/// Unix系统获取
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private MemoryMetrics GetUnixMetrics()
|
public MemoryMetrics GetUnixMetrics()
|
||||||
{
|
{
|
||||||
string output = ShellHelper.Bash("free -m");
|
string output = ShellHelper.Bash("free -m | awk '{print $2,$3,$4,$5,$6}'");
|
||||||
|
|
||||||
var lines = output.Split('\n');
|
|
||||||
var memory = lines[1].Split(' ', (char)StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
|
|
||||||
var metrics = new MemoryMetrics();
|
var metrics = new MemoryMetrics();
|
||||||
metrics.Total = double.Parse(memory[1]);
|
var lines = output.Split('\n', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||||
metrics.Used = double.Parse(memory[2]);
|
|
||||||
metrics.Free = double.Parse(memory[3]);
|
|
||||||
|
|
||||||
|
if (lines.Length <= 0) return metrics;
|
||||||
|
|
||||||
|
if (lines != null && lines.Length > 0)
|
||||||
|
{
|
||||||
|
var memory = lines[1].Split(' ', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (memory.Length >= 3)
|
||||||
|
{
|
||||||
|
metrics.Total = double.Parse(memory[0]);
|
||||||
|
metrics.Used = double.Parse(memory[1]);
|
||||||
|
metrics.Free = double.Parse(memory[2]);//m
|
||||||
|
}
|
||||||
|
}
|
||||||
return metrics;
|
return metrics;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -22,6 +22,7 @@ namespace Infrastructure
|
|||||||
public MailOptions MailOptions { get; set; }
|
public MailOptions MailOptions { get; set; }
|
||||||
public Upload Upload { get; set; }
|
public Upload Upload { get; set; }
|
||||||
public ALYUN_OCS ALYUN_OCS { get; set; }
|
public ALYUN_OCS ALYUN_OCS { get; set; }
|
||||||
|
public JwtSettings JwtSettings { get; set; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送邮件数据配置
|
/// 发送邮件数据配置
|
||||||
|
|||||||
@ -16,6 +16,7 @@ using ZR.Service.System.IService;
|
|||||||
using Hei.Captcha;
|
using Hei.Captcha;
|
||||||
using ZR.Common;
|
using ZR.Common;
|
||||||
using ZR.Service.System;
|
using ZR.Service.System;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace ZR.Admin.WebApi.Controllers.System
|
namespace ZR.Admin.WebApi.Controllers.System
|
||||||
{
|
{
|
||||||
@ -33,6 +34,8 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
private readonly SecurityCodeHelper SecurityCodeHelper;
|
private readonly SecurityCodeHelper SecurityCodeHelper;
|
||||||
private readonly ISysConfigService sysConfigService;
|
private readonly ISysConfigService sysConfigService;
|
||||||
private readonly ISysRoleService roleService;
|
private readonly ISysRoleService roleService;
|
||||||
|
private readonly OptionsSetting jwtSettings;
|
||||||
|
|
||||||
public SysLoginController(
|
public SysLoginController(
|
||||||
IHttpContextAccessor contextAccessor,
|
IHttpContextAccessor contextAccessor,
|
||||||
ISysMenuService sysMenuService,
|
ISysMenuService sysMenuService,
|
||||||
@ -41,7 +44,8 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
ISysPermissionService permissionService,
|
ISysPermissionService permissionService,
|
||||||
ISysConfigService configService,
|
ISysConfigService configService,
|
||||||
ISysRoleService sysRoleService,
|
ISysRoleService sysRoleService,
|
||||||
SecurityCodeHelper captcha)
|
SecurityCodeHelper captcha,
|
||||||
|
IOptions<OptionsSetting> jwtSettings)
|
||||||
{
|
{
|
||||||
httpContextAccessor = contextAccessor;
|
httpContextAccessor = contextAccessor;
|
||||||
SecurityCodeHelper = captcha;
|
SecurityCodeHelper = captcha;
|
||||||
@ -51,6 +55,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
this.sysConfigService = configService;
|
this.sysConfigService = configService;
|
||||||
roleService = sysRoleService;
|
roleService = sysRoleService;
|
||||||
|
this.jwtSettings = jwtSettings.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +87,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
|
|
||||||
LoginUser loginUser = new(user, roles, permissions);
|
LoginUser loginUser = new(user, roles, permissions);
|
||||||
CacheHelper.SetCache(GlobalConstant.UserPermKEY + user.UserId, loginUser);
|
CacheHelper.SetCache(GlobalConstant.UserPermKEY + user.UserId, loginUser);
|
||||||
return SUCCESS(JwtUtil.GenerateJwtToken(HttpContext.AddClaims(loginUser)));
|
return SUCCESS(JwtUtil.GenerateJwtToken(HttpContext.AddClaims(loginUser), jwtSettings.JwtSettings));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
|
using Infrastructure.Extensions;
|
||||||
using Infrastructure.Model;
|
using Infrastructure.Model;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
@ -7,8 +8,6 @@ using Microsoft.Extensions.Options;
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using ZR.Admin.WebApi.Filters;
|
|
||||||
using ZR.Common;
|
|
||||||
|
|
||||||
namespace ZR.Admin.WebApi.Controllers.monitor
|
namespace ZR.Admin.WebApi.Controllers.monitor
|
||||||
{
|
{
|
||||||
@ -17,7 +16,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor
|
|||||||
{
|
{
|
||||||
private OptionsSetting Options;
|
private OptionsSetting Options;
|
||||||
private IWebHostEnvironment HostEnvironment;
|
private IWebHostEnvironment HostEnvironment;
|
||||||
|
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
public MonitorController(IOptions<OptionsSetting> options, IWebHostEnvironment hostEnvironment)
|
public MonitorController(IOptions<OptionsSetting> options, IWebHostEnvironment hostEnvironment)
|
||||||
{
|
{
|
||||||
this.HostEnvironment = hostEnvironment;
|
this.HostEnvironment = hostEnvironment;
|
||||||
@ -55,13 +54,16 @@ namespace ZR.Admin.WebApi.Controllers.monitor
|
|||||||
string version = RuntimeInformation.FrameworkDescription;
|
string version = RuntimeInformation.FrameworkDescription;
|
||||||
string appRAM = ((double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + " MB";
|
string appRAM = ((double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + " MB";
|
||||||
string startTime = Process.GetCurrentProcess().StartTime.ToString("yyyy-MM-dd HH:mm:ss");
|
string startTime = Process.GetCurrentProcess().StartTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
string runTime = Process.GetCurrentProcess().StartTime.ToString("yyyy-MM-dd HH:mm:ss");
|
string sysRunTime = ComputerHelper.GetRunTime();
|
||||||
string serverIP = (Request.HttpContext.Connection.LocalIpAddress.MapToIPv4().ToString() + ":" + Request.HttpContext.Connection.LocalPort);//获取服务器IP
|
string serverIP = Request.HttpContext.Connection.LocalIpAddress.MapToIPv4().ToString() + ":" + Request.HttpContext.Connection.LocalPort;//获取服务器IP
|
||||||
|
|
||||||
|
var programStartTime = Process.GetCurrentProcess().StartTime;
|
||||||
|
string programRunTime = DateTimeHelper.FormatTime((DateTime.Now - programStartTime).TotalMilliseconds.ToString().Split('.')[0].ParseToLong());
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
cpu = ComputerHelper.GetComputerInfo(),
|
cpu = ComputerHelper.GetComputerInfo(),
|
||||||
sys = new { cpuNum, computerName, osName, osArch, serverIP },
|
disk = ComputerHelper.GetDiskInfos(),
|
||||||
|
sys = new { cpuNum, computerName, osName, osArch, serverIP, runTime = sysRunTime },
|
||||||
app = new
|
app = new
|
||||||
{
|
{
|
||||||
name = HostEnvironment.EnvironmentName,
|
name = HostEnvironment.EnvironmentName,
|
||||||
@ -70,9 +72,9 @@ namespace ZR.Admin.WebApi.Controllers.monitor
|
|||||||
version,
|
version,
|
||||||
appRAM,
|
appRAM,
|
||||||
startTime,
|
startTime,
|
||||||
runTime,
|
runTime = programRunTime,
|
||||||
host = serverIP
|
host = serverIP
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return SUCCESS(data);
|
return SUCCESS(data);
|
||||||
|
|||||||
@ -39,11 +39,12 @@ namespace ZR.Admin.WebApi.Framework
|
|||||||
/// 生成token
|
/// 生成token
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="claims"></param>
|
/// <param name="claims"></param>
|
||||||
|
/// <param name="jwtSettings"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GenerateJwtToken(List<Claim> claims)
|
public static string GenerateJwtToken(List<Claim> claims, JwtSettings jwtSettings)
|
||||||
{
|
{
|
||||||
JwtSettings jwtSettings = new();
|
//JwtSettings jwtSettings = new();
|
||||||
ConfigUtils.Instance.Bind("JwtSettings", jwtSettings);
|
//ConfigUtils.Instance.Bind("JwtSettings", jwtSettings);
|
||||||
|
|
||||||
var authTime = DateTime.Now;
|
var authTime = DateTime.Now;
|
||||||
var expiresAt = authTime.AddMinutes(jwtSettings.Expire);
|
var expiresAt = authTime.AddMinutes(jwtSettings.Expire);
|
||||||
|
|||||||
@ -123,7 +123,7 @@
|
|||||||
<span>磁盘状态</span>
|
<span>磁盘状态</span>
|
||||||
</div>
|
</div>
|
||||||
<el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" v-for="sysFile in server.disk" :key="sysFile.diskName" style="margin-bottom: 10px">
|
<el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" v-for="sysFile in server.disk" :key="sysFile.diskName" style="margin-bottom: 10px">
|
||||||
<div class="title">{{sysFile.dickName }}盘使用率</div>
|
<div class="title">{{sysFile.diskName }}盘使用率</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-tooltip placement="top-end">
|
<el-tooltip placement="top-end">
|
||||||
<div slot="content" style="font-size: 12px;">
|
<div slot="content" style="font-size: 12px;">
|
||||||
@ -132,6 +132,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="padding: 3px">
|
<div style="padding: 3px">
|
||||||
空闲:{{ sysFile.availableFreeSpace }}GB
|
空闲:{{ sysFile.availableFreeSpace }}GB
|
||||||
|
</div>
|
||||||
|
<div style="padding: 3px">
|
||||||
|
已用:{{ sysFile.used }}GB
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -139,7 +142,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">{{ sysFile.availableFreeSpace }}G / {{ sysFile.totalSize }}G</div>
|
<div class="footer">{{ sysFile.availableFreeSpace }}GB可用,共{{ sysFile.totalSize }}GB</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -264,7 +267,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.intervalId = setInterval(() => {
|
this.intervalId = setInterval(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
}, 5000);
|
}, 10000);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 停止定时器
|
* 停止定时器
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user