munin: emit 0, not "None", when there's no bytes usage to report

This commit is contained in:
Brian Warner 2018-02-12 17:43:46 -08:00
parent 481def1937
commit 91d3bd8e90
2 changed files with 2 additions and 2 deletions

View File

@ -33,5 +33,5 @@ if time.time() > updated + 5*MINUTE:
sys.exit(1) # expired
value = db.execute("SELECT SUM(`total_bytes`) FROM `usage` WHERE `started` > ?",
(rebooted,)).fetchone()[0]
(rebooted,)).fetchone()[0] or 0
print("bytes.value", value)

View File

@ -32,5 +32,5 @@ updated = db.execute("SELECT `updated` FROM `current`").fetchone()[0]
if time.time() > updated + 5*MINUTE:
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] or 0
print("bytes.value", value)