X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=health_renderer.py;h=5416af2fb1bebb847af55f8522b9edfb27232624;hb=6b8d4eeb7153617221f822a243a117f0bcab07bf;hp=302e793efda2b5e5ae968a38ffcaa8adab22e1a0;hpb=144f769da44d2a8411e320e2e66ad1dbc48ed091;p=kiosk.git
diff --git a/health_renderer.py b/health_renderer.py
index 302e793..5416af2 100644
--- a/health_renderer.py
+++ b/health_renderer.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import logging
import os
import time
from typing import Dict
@@ -10,12 +11,12 @@ import renderer
import utils
-class periodic_health_renderer(renderer.debuggable_abstaining_renderer):
- def __init__(self, name_to_timeout_dict: Dict[str, int]) -> None:
- super(periodic_health_renderer, self).__init__(name_to_timeout_dict, False)
+logger = logging.getLogger(__file__)
+
- def debug_prefix(self) -> str:
- return "health"
+class periodic_health_renderer(renderer.abstaining_renderer):
+ def __init__(self, name_to_timeout_dict: Dict[str, int]) -> None:
+ super().__init__(name_to_timeout_dict)
def periodic_render(self, key: str) -> bool:
with file_writer.file_writer("periodic-health_6_300.html") as f:
@@ -52,7 +53,7 @@ class periodic_health_renderer(renderer.debuggable_abstaining_renderer):
timestamps + "last_backup_disk_selftest_long": days * 31,
timestamps + "last_cabin_disk_selftest_short": days * 14,
timestamps + "last_cabin_disk_selftest_long": days * 31,
- timestamps + "last_cabin_rpi_ping": mins * 10,
+ timestamps + "last_cabin_rpi_ping": mins * 20,
timestamps + "last_healthy_wifi": mins * 10,
timestamps + "last_healthy_network": mins * 10,
timestamps + "last_scott_sync": days * 2,
@@ -64,7 +65,7 @@ class periodic_health_renderer(renderer.debuggable_abstaining_renderer):
for filepath, limit_sec in sorted(limits.items()):
ts = os.stat(filepath).st_mtime
age = now - ts
- self.debug_print(f"{filepath} -- age: {age}, limit {limit_sec}")
+ logger.debug(f"{filepath} -- age: {age}, limit {limit_sec}")
if age < limits[filepath]:
# OK
f.write(
@@ -84,7 +85,7 @@ class periodic_health_renderer(renderer.debuggable_abstaining_renderer):
name = name.replace("_", " ")
duration = utils.describe_duration_briefly(int(age))
- self.debug_print(f"{name} is {duration} old.")
+ logger.debug(f"{name} is {duration} old.")
f.write(f"{name}
\n{duration} old.\n")
f.write("\n\n\n")
n += 1