From 35774ad6e775c6ef041c1dc7c9cc46a5c87f8820 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 17 Jun 2018 15:00:28 -0700 Subject: [PATCH] munin/wormhole_errors: fix it to be since-reboot, not all-time --- misc/munin/wormhole_errors | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/misc/munin/wormhole_errors b/misc/munin/wormhole_errors index 5716287..06054c3 100755 --- a/misc/munin/wormhole_errors +++ b/misc/munin/wormhole_errors @@ -38,14 +38,20 @@ updated,rebooted = usage_db.execute("SELECT `updated`,`rebooted` FROM `current`" if time.time() > updated + 6*MINUTE: sys.exit(1) # expired -r1 = usage_db.execute("SELECT COUNT() FROM `nameplates`").fetchone()[0] +r1 = usage_db.execute("SELECT COUNT() FROM `nameplates` WHERE `started` >= ?", + (rebooted,)).fetchone()[0] r2 = usage_db.execute("SELECT COUNT() FROM `nameplates`" - " WHERE `result` = 'happy'").fetchone()[0] + " WHERE `started` >= ?" + " AND `result` = 'happy'", + (rebooted,)).fetchone()[0] print("nameplates.value", (r1 - r2)) -r1 = usage_db.execute("SELECT COUNT() FROM `mailboxes`").fetchone()[0] -r2 = usage_db.execute("SELECT COUNT() FROM `mailboxes`" - " WHERE `result` = 'happy'").fetchone()[0] +r1 = usage_db.execute("SELECT COUNT() FROM `mailboxes` WHERE `started` >= ?", + (rebooted,)).fetchone()[0] +r2 = usage_db.execute("SELECT COUNT() FROM `mailboxes` WHERE `started` >= ?" + " AND `result` = 'happy'", + (rebooted,)).fetchone()[0] print("mailboxes.value", (r1 - r2)) -r = usage_db.execute("SELECT COUNT() FROM `mailboxes`" - " WHERE `result` = 'scary'").fetchone()[0] +r = usage_db.execute("SELECT COUNT() FROM `mailboxes` WHERE `started` >= ?" + " AND `result` = 'scary'", + (rebooted,)).fetchone()[0] print("mailboxes_scary.value", r)