Author: eallen
Date: 2008-12-16 15:07:36 -0500 (Tue, 16 Dec 2008)
New Revision: 3010
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/system.strings
Log:
Added free memory and load average to sysimage status box.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-16 19:47:55 UTC (rev 3009)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-16 20:07:36 UTC (rev 3010)
@@ -691,7 +691,9 @@
class LoadStat(CuminStat):
def value_text(self, object):
- return "%0.2f" % self.value(object)
+ value = self.value(object)
+ text = value and "%0.2f" % value or ""
+ return text
class SystemSlotVisualization(SlotVisualization):
def __init__(self, cls, name):
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-12-16 19:47:55 UTC (rev 3009)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-12-16 20:07:36 UTC (rev 3010)
@@ -110,8 +110,12 @@
self.set_view_mode(self.view)
class SystemStatus(CuminStatus):
- pass
+ def render_mem_free(self, session, system):
+ return self.app.model.system.memFree.value_html(system)
+ def render_load_average(self, session, system):
+ return self.app.model.system.loadAverage1Min.value_html(system)
+
class SystemStats(Widget):
def __init__(self, app, name):
super(SystemStats, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2008-12-16 19:47:55 UTC (rev 3009)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2008-12-16 20:07:36 UTC (rev 3010)
@@ -83,6 +83,38 @@
return false;
}
+[SystemStatus.javascript]
+function updateSystemStatus(id, system) {
+ updateStatus(id, system);
+
+ var s = system.stat;
+ var sdata = {
+ "tr": [
+ {"td": [s.memFree.value]},
+ {"td": [s.loadAverage1Min.value]}
+ ]
+ };
+
+ wooly.doc().elembyid(id).descendant("table.tbody").update(sdata);
+}
+
+[SystemStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <table>
+ <tr>
+ <th>Free Memory</th>
+ <td class="ralign">{mem_free}</td>
+ </tr>
+ <tr>
+ <th>Load Average</th>
+ <td class="ralign">{load_average}</td>
+ </tr>
+ </table>
+</div>
+<script type="text/javascript">
+ cumin.objectListeners["{id}"] = updateSystemStatus
+</script>
+
[SystemStats.html]
<table class="twocol">
<tbody>