- timestamps = "/timestamps/"
- days = constants.seconds_per_day
- hours = constants.seconds_per_hour
- mins = constants.seconds_per_minute
- minutes = mins
- limits = {
- timestamps + "last_http_probe_wannabe_house": mins * 10,
- timestamps + "last_http_probe_meerkat_cabin": mins * 10,
- timestamps + "last_http_probe_dns_house": mins * 10,
- timestamps + "last_http_probe_rpi_cabin": mins * 10,
- timestamps + "last_http_probe_rpi_house": mins * 10,
- timestamps + "last_http_probe_therm_house": mins * 10,
- timestamps + "last_rsnapshot_hourly": hours * 24,
- timestamps + "last_rsnapshot_daily": days * 3,
- timestamps + "last_rsnapshot_weekly": days * 14,
- timestamps + "last_rsnapshot_monthly": days * 70,
- timestamps + "last_zfssnapshot_hourly": hours * 5,
- timestamps + "last_zfssnapshot_daily": hours * 36,
- timestamps + "last_zfssnapshot_weekly": days * 9,
- timestamps + "last_zfssnapshot_monthly": days * 70,
- timestamps + "last_zfssnapshot_cleanup": hours * 24,
- timestamps + "last_zfs_scrub": days * 9,
- timestamps + "last_backup_zfs_scrub": days * 9,
- timestamps + "last_cabin_zfs_scrub": days * 9,
- timestamps + "last_zfsxfer_backup.house": hours * 36,
- timestamps + "last_zfsxfer_ski.dyn.guru.org": days * 7,
- timestamps + "last_photos_sync": hours * 8,
- timestamps + "last_disk_selftest_short": days * 14,
- timestamps + "last_disk_selftest_long": days * 31,
- timestamps + "last_backup_disk_selftest_short": days * 14,
- 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_healthy_wifi": mins * 10,
- timestamps + "last_healthy_network": mins * 10,
- timestamps + "last_scott_sync": days * 2,
- }
- self.write_header(f)
-
- now = time.time()
- n = 0
- for x in sorted(limits):
- ts = os.stat(x).st_mtime
- age = now - ts
- self.debug_print("%s -- age is %ds, limit is %ds" % (x, age, limits[x]))
- if age < limits[x]:
- f.write(
- '<TD BGCOLOR="#007010" HEIGHT=100 WIDTH=33% STYLE="text-size:60%; vertical-align: middle;">\n'
- )
- else:
- f.write(
- '<TD BGCOLOR="#990000" HEIGHT=100 WIDTH=33% CLASS="invalid" STYLE="text-size:60%; vertical-align:middle;">\n'
- )
- f.write(" <CENTER><FONT SIZE=-2>\n")
-
- name = x.replace(timestamps, "")
- name = name.replace("last_", "")
- name = name.replace("_", " ")
- ts = utils.describe_duration_briefly(age)
-
- self.debug_print(f"{name} is {ts} old.")
- f.write(f"{name}<BR>\n<B>{ts}</B> old.\n")
- f.write("</FONT></CENTER>\n</TD>\n\n")
- n += 1
- if n % 3 == 0:
- f.write("</TR>\n<TR>\n<!-- ------------------- -->\n")
- self.write_footer(f)