Mehr Graphen
This commit is contained in:
@@ -249,4 +249,42 @@ public class MonitoringController : Controller
|
||||
|
||||
return Ok(data);
|
||||
}
|
||||
|
||||
[HttpGet("ram-usage")]
|
||||
public async Task<IActionResult> GetRamUsageData()
|
||||
{
|
||||
var oneDayAgo = DateTime.UtcNow.AddDays(-1);
|
||||
var data = await _context.Metrics
|
||||
.Where(m => m.Timestamp >= oneDayAgo)
|
||||
.OrderBy(m => m.Timestamp)
|
||||
.Select(m => new
|
||||
{
|
||||
// Hier die Formatierung anpassen
|
||||
// 'o' ist der Standard-Formatbezeichner für ISO 8601-Format mit Zeitzone
|
||||
label = m.Timestamp.ToUniversalTime().ToString("o"), // Wichtig: ToUniversalTime() für Konsistenz
|
||||
data = m.RAM_Load
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Ok(data);
|
||||
}
|
||||
|
||||
[HttpGet("gpu-usage")]
|
||||
public async Task<IActionResult> GetGpuUsageData()
|
||||
{
|
||||
var oneDayAgo = DateTime.UtcNow.AddDays(-1);
|
||||
var data = await _context.Metrics
|
||||
.Where(m => m.Timestamp >= oneDayAgo)
|
||||
.OrderBy(m => m.Timestamp)
|
||||
.Select(m => new
|
||||
{
|
||||
// Hier die Formatierung anpassen
|
||||
// 'o' ist der Standard-Formatbezeichner für ISO 8601-Format mit Zeitzone
|
||||
label = m.Timestamp.ToUniversalTime().ToString("o"), // Wichtig: ToUniversalTime() für Konsistenz
|
||||
data = m.RAM_Load
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Ok(data);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user