sanitizeMetrics Funktion erstellt

This commit is contained in:
2025-09-30 12:21:25 +02:00
parent 32a6c0d108
commit 5e2f9e4c3c
2 changed files with 15 additions and 24 deletions

View File

@@ -183,7 +183,7 @@ public class MonitoringController : Controller
GPU_Temp = dto.GPU_Temp,
GPU_Vram_Size = dto.GPU_Vram_Size,
GPU_Vram_Usage = dto.GPU_Vram_Usage,
RAM_Load = dto.RAM_Load,
RAM_Load = sanitizeByteInput(dto.RAM_Load),
RAM_Size = dto.RAM_Size,
DISK_Size = dto.RAM_Size,
DISK_Usage = dto.DISK_Usage,
@@ -281,4 +281,18 @@ public class MonitoringController : Controller
return Ok(data);
}
// Metric Input Byte zu Gigabyte umwandeln
public static double sanitizeByteInput(double metric_input)
{
// *10^-9 um auf Gigabyte zu kommen
double sanitizedMetric = metric_input * Math.Pow(10, -9);
// Auf 2 Nachkommastellen runden
Math.Round(sanitizedMetric, 2);
return sanitizedMetric;
}
// Metric Input Bit zu Gigabit umwandeln
}