From 09a4319e30f5fadf17cbc5fbbef03bb2a35c5f0f Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 6 Jul 2011 15:56:31 +0200 Subject: [PATCH] tweaked the header of the node page to display the 'UP' and 'DOWN' numbers with percentages --- web/MonitorWeb/monitorweb/templates/nodefast.kid | 13 +++++++++++-- web/MonitorWeb/monitorweb/templates/nodelist.kid | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/web/MonitorWeb/monitorweb/templates/nodefast.kid b/web/MonitorWeb/monitorweb/templates/nodefast.kid index 253dc2f..2052b85 100644 --- a/web/MonitorWeb/monitorweb/templates/nodefast.kid +++ b/web/MonitorWeb/monitorweb/templates/nodefast.kid @@ -5,6 +5,15 @@ from monitor.util import diff_time from time import mktime from links import * +def up_label (query): + up=len([agg for agg in query if agg.node.status in ('online', 'good')]) + total=len(query) + return "%d (%d %%)" %(up,100*up/total) +def down_label (query): + down=len([agg for agg in query if agg.node.status not in ('online', 'good')]) + total=len(query) + return "%d (%d %%)" %(down,100*down/total) + ?>
- | -
+ | +
diff --git a/web/MonitorWeb/monitorweb/templates/nodelist.kid b/web/MonitorWeb/monitorweb/templates/nodelist.kid index 2c1ae70..e07fb63 100644 --- a/web/MonitorWeb/monitorweb/templates/nodelist.kid +++ b/web/MonitorWeb/monitorweb/templates/nodelist.kid @@ -5,6 +5,15 @@ from monitor.util import diff_time from time import mktime from links import * +def up_label (query): + up=len([agg for agg in query if agg.node.status in ('online', 'good')]) + total=len(query) + return "%d (%d %%)" %(up,100*up/total) +def down_label (query): + down=len([agg for agg in query if agg.node.status not in ('online', 'good')]) + total=len(query) + return "%d (%d %%)" %(down,100*down/total) + ?> - +
-- 2.43.0