From 7411d3cd735e5ed0bb0b8a34a95b06f7bd781c4e Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 12 Feb 2018 17:04:45 -0800 Subject: [PATCH] rename, edit munin plugins to match new moods Instead of an "errors" graph, we now just track all events (happy too). --- ...ormhole_transit => wormhole_transit_bytes} | 0 ...alltime => wormhole_transit_bytes_alltime} | 0 ...transit_errors => wormhole_transit_events} | 22 ++++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) rename misc/munin/{wormhole_transit => wormhole_transit_bytes} (100%) rename misc/munin/{wormhole_transit_alltime => wormhole_transit_bytes_alltime} (100%) rename misc/munin/{wormhole_transit_errors => wormhole_transit_events} (65%) 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)