Author: eallen
Date: 2008-11-26 17:35:22 -0500 (Wed, 26 Nov 2008)
New Revision: 2891
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/slot.strings
Log:
Partial solution to multiple collectors.
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-11-26 20:26:37 UTC (rev 2890)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-11-26 22:35:22 UTC (rev 2891)
@@ -286,7 +286,7 @@
return {"pool": pool.id}
def render_sql_orderby(self, session, pool):
- return "order by machine asc"
+ return "order by id asc"
class PoolStats(Widget):
def __init__(self, app, name):
Modified: mgmt/trunk/cumin/python/cumin/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.strings 2008-11-26 20:26:37 UTC (rev 2890)
+++ mgmt/trunk/cumin/python/cumin/slot.strings 2008-11-26 22:35:22 UTC (rev 2891)
@@ -1,6 +1,6 @@
[SlotSet.sql]
-select
- s.id,
+select distinct
+ s.name as id,
s.name,
s.machine,
s.system,
@@ -21,16 +21,21 @@
{sql_where}
[MachineSet.sql]
-select
+select
machine as id,
- machine,
- sum(case c.activity when 'Busy' then 1 else 0 end) as busy,
- sum(case c.activity when 'Idle' then 1 else 0 end) as idle,
- sum(1) as total
-from slot as s
-left outer join slot_stats as c on c.id = s.stats_curr_id
+ machine,
+ sum(case activity when 'Busy' then 1 else 0 end) / coll_count as busy,
+ sum(case activity when 'Idle' then 1 else 0 end) / coll_count as idle,
+ sum(1) / coll_count as total
+from
+(select
+ machine, s.pool, c.activity, count(coll.id) as coll_count
+ from slot as s
+ left outer join slot_stats as c on c.id = s.stats_curr_id
+ left outer join collector as coll on coll.pool = s.pool
+ group by machine, s.pool, c.activity, s.stats_curr_id) as s
{sql_where}
-group by machine
+group by machine, coll_count
{sql_orderby}
[MachineSet.count_sql]
Show replies by date