]> git.ipfire.org Git - ipfire.org.git/commitdiff
cluster: Added speed field and changes jobs into a nice bar.
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 6 Jul 2009 15:35:38 +0000 (17:35 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 6 Jul 2009 15:35:38 +0000 (17:35 +0200)
There were also some minor fixes like the update interval.

www/pages/cluster/__init__.py

index b74ba63bd99b0aebe7217fce3cbb5af73c15ce8a..d8f787c7ced048c04400739055fd5827450ea2f3 100644 (file)
@@ -10,7 +10,7 @@ class Content(web.Content):
                self.cluster = web.cluster.Cluster("minerva.ipfire.org")
 
        def __call__(self, lang):
-               ret = "<h3>Cluster Monitoring</h4>"
+               ret = "<h3>Icecream Cluster Monitoring</h4>"
 
                ret += """<script type="text/javascript">
                                nodes = new Array();
@@ -18,23 +18,27 @@ class Content(web.Content):
                                update = function() {
                                        $.getJSON("http://www.ipfire.org/rpc.py", { type: "cluster" },
                                                function(data) {
+                                                       var count = 0;
                                                        $.each(data.nodes, function(i, node) {
-                                                               var nodeid = node.hostname.replace(".", "").replace(".", "");
+                                                               var nodeid = node.hostname.replace(/\./g, "");
+                                                               count++;
 
                                                                nodes[nodeid] = true;
 
                                                                if ($("#" + nodeid).length) {
-                                                                       $("#" + nodeid + "_jobs").html(node.jobs);
+                                                                       $("#" + nodeid + "_speed").html(node.speed);
                                                                } else {
                                                                        row  = "<tr id=\\"" + nodeid + "\\" class=\\"node\\">";
                                                                        row += "  <td id=\\"" + nodeid + "_hostname\\">" + node.hostname + "</td>";
                                                                        row += "  <td id=\\"" + nodeid + "_arch\\">" + node.arch + "</td>";
                                                                        row += "  <td><span id=\\"" + nodeid + "_loadbar\\"></span></td>";
-                                                                       row += "  <td id=\\"" + nodeid + "_jobs\\">" + node.jobs + "</td>";
+                                                                       row += "  <td><span id=\\"" + nodeid + "_jobs\\"></span></td>";
+                                                                       row += "  <td id=\\"" + nodeid + "_speed\\">" + node.speed + "</td>";
                                                                        row += "</tr>";
                                                                        $("#nodes").append(row);
                                                                }
                                                                $("#" + nodeid + "_loadbar").progressBar(node.load, {showText: false});
+                                                               $("#" + nodeid + "_jobs").progressBar(node.jobs.split("/")[0], { max: node.jobs.split("/")[1], textFormat: 'fraction'}); 
                                                        });
                                                        $("#loadbar").progressBar(data.cluster.load);
                                                        for (var nodeid in nodes) {
@@ -45,6 +49,7 @@ class Content(web.Content):
                                                                        nodes[nodeid] = false;
                                                                }
                                                        }
+                                                       $("#count").html(count);
                                        });
                                }
 
@@ -53,11 +58,11 @@ class Content(web.Content):
                                        $("#loadbar").progressBar();
 
                                        update();
-                                       setInterval("update()", 2500);
+                                       setInterval("update()", 2000);
                                })
                        </script>"""            
 
-               ret += """<p>Cluster's load: <span id="loadbar"></span></p>
+               ret += """<p>Cluster's load: <span id="loadbar"></span>  - Number of nodes: <span id="count">-</span></p>
                                <table id="nodes">
                                        <thead>
                                                <tr>
@@ -65,6 +70,7 @@ class Content(web.Content):
                                                        <th>Arch</th>
                                                        <th>Load</th>
                                                        <th>Jobs</th>
+                                                       <th>Speed</th>
                                                </tr>
                                        </thead>
                                        <tbody>