diff --git a/misc/munin/wormhole_transit b/misc/munin/wormhole_transit_bytes similarity index 100% rename from misc/munin/wormhole_transit rename to misc/munin/wormhole_transit_bytes diff --git a/misc/munin/wormhole_transit_alltime b/misc/munin/wormhole_transit_bytes_alltime similarity index 100% rename from misc/munin/wormhole_transit_alltime rename to misc/munin/wormhole_transit_bytes_alltime diff --git a/misc/munin/wormhole_transit_errors b/misc/munin/wormhole_transit_events similarity index 65% rename from misc/munin/wormhole_transit_errors rename to misc/munin/wormhole_transit_events index d5dc16a..2690cdf 100755 --- a/misc/munin/wormhole_transit_errors +++ b/misc/munin/wormhole_transit_events @@ -11,15 +11,21 @@ from __future__ import print_function import os, sys, time, sqlite3 CONFIG = """\ -graph_title Magic-Wormhole Transit Server Errors (since reboot) +graph_title Magic-Wormhole Transit Server Events (since reboot) graph_vlabel Events Since Reboot graph_category network +happy.label Happy +happy.draw LINE1 +happy.type GAUGE errory.label Errory errory.draw LINE1 errory.type GAUGE lonely.label Lonely lonely.draw LINE1 lonely.type GAUGE +redundant.label Redundant +redundant.draw LINE1 +redundant.type GAUGE """ if len(sys.argv) > 1 and sys.argv[1] == "config": @@ -35,6 +41,13 @@ rebooted,updated = db.execute("SELECT `rebooted`, `updated` FROM `current`").fet if time.time() > updated + 5*MINUTE: sys.exit(1) # expired +count = db.execute("SELECT COUNT() FROM `usage`" + " WHERE" + " `started` > ? AND" + " `result` = 'happy'", + (rebooted,)).fetchone()[0] +print("happy.value", count) + count = db.execute("SELECT COUNT() FROM `usage`" " WHERE" " `started` > ? AND" @@ -48,3 +61,10 @@ count = db.execute("SELECT COUNT() FROM `usage`" " `result` = 'lonely'", (rebooted,)).fetchone()[0] print("lonely.value", count) + +count = db.execute("SELECT COUNT() FROM `usage`" + " WHERE" + " `started` > ? AND" + " `result` = 'redundant'", + (rebooted,)).fetchone()[0] +print("redundant.value", count)