Alert when Livepatch is broken or has stopped reporting
The alert check now also notifies, once per problem, when a host's Livepatch has been unhealthy for livepatch_alert_after_hours (default 6), or when a host that used to report Livepatch no longer does (a dead daemon leaves the agent with nothing to send). A livepatch_alerts table records which hosts have reported Livepatch, when the current problem began and whether it was notified, so hosts without Livepatch never alert and restarts do not repeat messages. Stale hosts are skipped. livepatch_problem() is now the single test for unhealthy, shared with the cover rule for pending reboots, and names the check state when that is the problem. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
203c729e14
commit
650806bfce
7 files changed
+346
-6
No files matched your search
@@ -75,6 +75,15 @@ class ConfigTest(unittest.TestCase):
|
||||
with self.subTest(bad=bad), self.assertRaises(SystemExit):
|
||||
config.load(self.write(tmp, f"report_min_interval_seconds = {bad}\n"))
|
||||
|
||||
def test_livepatch_alert_hours_validated(self):
|
||||
with tempdir() as tmp:
|
||||
self.assertEqual(config.Config().livepatch_alert_after_hours, 6.0)
|
||||
self.assertEqual(config.load(self.write(tmp, "livepatch_alert_after_hours = 0\n"))
|
||||
.livepatch_alert_after_hours, 0)
|
||||
for bad in ("-1", "inf", "nan", '"6"'):
|
||||
with self.subTest(bad=bad), self.assertRaises(SystemExit):
|
||||
config.load(self.write(tmp, f"livepatch_alert_after_hours = {bad}\n"))
|
||||
|
||||
def test_status_alert_hours_validated(self):
|
||||
with tempdir() as tmp:
|
||||
self.assertEqual(config.load(self.write(tmp, "status_alert_after_hours = 0\n"))
|
||||
|
||||
Reference in new issue
Block a user