This is a resend of the proposed patch that was requested to be added 
2 months ago for a future 3.0 release :

  
http://www.mail-archive.com/ganglia-developers@lists.sourceforge.net/msg04024.html

The patch itself (which is a slightly modified version from the one proposed
in the bug report) is more than 3 years old and has been rebased to apply to
the current head for the monitor-core-3.0 branch.

The following proposed patch for stable 3.0, fixes BUG36 by displaying
correctly the time since the last received heartbeat for a node that is
down as detailed in :
 
  http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=36

The template for the show_node page has been changed to display a message to
report if the cluster is down (as that will freeze the counter) and to display
the counter using an uptime format if older than 1 hour (as used elsewhere)
so that the observed downtime from a node could be quickly identified.

Contains changes from r1244, r1248, r1249 and r1318 and has been already
backported to stable 3.1 in r1366.

Carlo

---
Index: web/templates/default/show_node.tpl
===================================================================
--- web/templates/default/show_node.tpl (revision 1442)
+++ web/templates/default/show_node.tpl (working copy)
@@ -15,8 +15,9 @@
    <i>{ip}</i><br>
    <em>Location:</em> {location}<p>
 
-   Last heartbeat received {age} ago.{down}<br>
-   Uptime {uptime}
+   Last heartbeat received {age} ago.<br>
+   Uptime {uptime}<br>
+   {message}
 
    </td>
    <td align=right valign=top>
Index: web/show_node.php
===================================================================
--- web/show_node.php   (revision 1442)
+++ web/show_node.php   (working copy)
@@ -32,7 +32,7 @@
 # $metrics is an array of [Metrics][Hostname][NAME|VAL|TYPE|UNITS|SOURCE].
 
 # Find the host's physical location in the cluster.
-$hostattrs = (is_array($hosts_up)) ? $hosts_up : $hosts_down;
+$hostattrs = ($up) ? $hosts_up : $hosts_down;
 list($rack,$rank,$plane) = findlocation($hostattrs);
 $location = ($rack<0) ? "Unknown" : "Rack $rack, Rank $rank, Plane $plane.";
 $tpl->assign("location",$location);
@@ -69,11 +69,15 @@
 $clustertime=$cluster['LOCALTIME'];
 $heartbeat=$hostattrs['REPORTED'];
 $age = $clustertime - $heartbeat;
-$s = ($age>1) ? "s" : "";
-$tpl->assign("age","$age second$s");
-if (!$up) {
-   $tpl->assign("down","<br><b>This node is down.</b>");
+if ($age > 3600) {
+  $tpl->assign("age", uptime($age));
+} else {
+  $s = ($age > 1) ? "s" : "";
+  $tpl->assign("age", "$age second$s");
 }
+if ((!$up) && ($cluster['HOSTS_UP'] == 0)) {
+   $tpl->assign("message","<b>This cluster is down.</b>");
+}
 
 # The these hardware units should be more flexible.
 $s = ($cpu_num>1) ? "s" : "";
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to