Implemented node system statistics
This commit is contained in:
22
MoonlightServers.Daemon/Http/Controllers/SystemController.cs
Normal file
22
MoonlightServers.Daemon/Http/Controllers/SystemController.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MoonlightServers.Daemon.Helpers;
|
||||
using MoonlightServers.Daemon.Mappers;
|
||||
using MoonlightServers.DaemonShared.Http.Daemon;
|
||||
|
||||
namespace MoonlightServers.Daemon.Http.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/system")]
|
||||
public class SystemController : Controller
|
||||
{
|
||||
[HttpGet("statistics")]
|
||||
public async Task<ActionResult<SystemStatisticsDto>> GetStatisticsAsync()
|
||||
{
|
||||
var snapshot = await SystemMetrics.ReadAllAsync();
|
||||
var statistics = SystemStatisticsMapper.ToDto(snapshot);
|
||||
|
||||
return statistics;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user