munin: fix rebooted-vs-updated check

This commit is contained in:
Brian Warner 2017-11-09 22:09:27 -08:00
parent 2ddc6566e2
commit 49ae79fc2e
4 changed files with 9 additions and 9 deletions

View File

@ -27,8 +27,8 @@ assert os.path.exists(dbfile)
db = sqlite3.connect(dbfile) db = sqlite3.connect(dbfile)
MINUTE = 60.0 MINUTE = 60.0
rebooted = db.execute("SELECT `rebooted` FROM `current`").fetchone()[0] updated,rebooted = db.execute("SELECT `updated`,`rebooted` FROM `current`").fetchone()
if time.time() > rebooted + 5*MINUTE: if time.time() > updated + 5*MINUTE:
sys.exit(1) # expired sys.exit(1) # expired
value = db.execute("SELECT SUM(`total_bytes`) FROM `usage` WHERE `started` > ?", value = db.execute("SELECT SUM(`total_bytes`) FROM `usage` WHERE `started` > ?",

View File

@ -30,9 +30,9 @@ assert os.path.exists(dbfile)
db = sqlite3.connect(dbfile) db = sqlite3.connect(dbfile)
MINUTE = 60.0 MINUTE = 60.0
rebooted,waiting,connected = db.execute("SELECT `rebooted`,`waiting`,`connected`" updated,waiting,connected = db.execute("SELECT `updated`,`waiting`,`connected`"
" FROM `current`").fetchone() " FROM `current`").fetchone()
if time.time() > rebooted + 5*MINUTE: if time.time() > updated + 5*MINUTE:
sys.exit(1) # expired sys.exit(1) # expired
print("waiting.value", waiting) print("waiting.value", waiting)

View File

@ -27,8 +27,8 @@ assert os.path.exists(dbfile)
db = sqlite3.connect(dbfile) db = sqlite3.connect(dbfile)
MINUTE = 60.0 MINUTE = 60.0
rebooted = db.execute("SELECT `rebooted` FROM `current`").fetchone()[0] updated = db.execute("SELECT `updated` FROM `current`").fetchone()[0]
if time.time() > rebooted + 5*MINUTE: if time.time() > updated + 5*MINUTE:
sys.exit(1) # expired sys.exit(1) # expired
value = db.execute("SELECT SUM(`total_bytes`) FROM `usage`").fetchone()[0] value = db.execute("SELECT SUM(`total_bytes`) FROM `usage`").fetchone()[0]

View File

@ -30,8 +30,8 @@ assert os.path.exists(dbfile)
db = sqlite3.connect(dbfile) db = sqlite3.connect(dbfile)
MINUTE = 60.0 MINUTE = 60.0
rebooted = db.execute("SELECT `rebooted` FROM `current`").fetchone()[0] rebooted,updated = db.execute("SELECT `rebooted`, `updated` FROM `current`").fetchone()
if time.time() > rebooted + 5*MINUTE: if time.time() > updated + 5*MINUTE:
sys.exit(1) # expired sys.exit(1) # expired
count = db.execute("SELECT COUNT() FROM `usage`" count = db.execute("SELECT COUNT() FROM `usage`"