show more detail in checks tab #2014

This commit is contained in:
wh1te909 2024-10-15 08:31:06 +00:00
parent dfccbceea6
commit 18cac8ba5d
1 changed files with 3 additions and 1 deletions

View File

@ -365,9 +365,11 @@ class CheckResult(models.Model):
if len(self.history) > 15:
self.history = self.history[-15:]
update_fields.extend(["history"])
update_fields.extend(["history", "more_info"])
avg = int(mean(self.history))
txt = "Memory Usage" if check.check_type == CheckType.MEMORY else "CPU Load"
self.more_info = f"Average {txt}: {avg}%"
if check.error_threshold and avg > check.error_threshold:
self.status = CheckStatus.FAILING