#!/usr/bin/env python3
+import logging
import os
import time
-from typing import Dict, List
+from typing import Dict
import constants
import file_writer
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:
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,
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(
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}<BR>\n<B>{duration}</B> old.\n")
f.write("</FONT></CENTER>\n</TD>\n\n")
n += 1