/*******************************************************************************
* Copyright © 2020 HT.Cloud.Framework 版权所有
* Author: HT.Cloud
* Description: WaterCloud快速开发平台
* Website:
*********************************************************************************/
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Threading.Tasks;
using HT.Cloud.Code;
using HT.Cloud.Service.DevicesManage;
using Quartz;
namespace HT.Cloud.Web.Areas.DevicesManage.Controllers
{
[Area("DevicesManage")]
[HandlerLogin(needLogin: false)]
[HandlerAuthorize(needAuth: false)]
public class DeviceMonitoringController : BaseController
{
public RealTimeDeviceStateService _realTimeDeviceState { get; set; }
///
/// 绑定数据仓库的数据库ID
///
private string systemDescription = GlobalContext.SystemConfig.SystemDescription;
[HttpGet]
public async Task GetServerDataJson()
{
return await Task.Run(() =>
{
var computer = ComputerHelper.GetComputerInfo();
var arm = computer.RAMRate;
var cpu = computer.CPURate;
var iis = computer.RunTime;
var TotalRAM = computer.TotalRAM;
string ip = WebHelper.GetWanIp();
string ipLocation = WebHelper.GetIpLocation(ip);
var IP = string.Format("{0} ({1})", ip, ipLocation);
return Content(new { ARM = arm, CPU = cpu, IIS = iis, TotalRAM = TotalRAM, IP = IP }.ToJson());
});
}
//[HttpGet]
//public async Task GetRealIOGroup()
//{
// var listgroup = _realTimeIOState.GetIOGroup(systemDescription);
// return Content(listgroup.ToJson());
//}
//[HttpGet]
//public async Task GetRealIOInfo()
//{
// var listinfo = _realTimeIOState.GetIOInfo(systemDescription);
// return Content(listinfo.ToJson());
//}
[HttpGet]
public async Task GetRealDeviceTag()
{
var data = _realTimeDeviceState.GetRealDeviceTag(systemDescription);
return Content(data.Result);
}
}
}