I have attached a small patch for the webfrontend that adds a gmond
started timestamp and uptime-style last reported time to the time &
string metrics on the host view.  Included with this is a corrected
uptime function that properly formats the time string and adds seconds.

I also attached a simple patch to eliminate the following php warning
that I am seeing in my apache error log file:

[error] PHP Warning:  Call-time pass-by-reference has been deprecated -
argument passed by value;  If you would like to pass it by reference,
modify the declaration of fsockopen().  If you would like to enable
call-time pass-by-reference, you can set allow_call_time_pass_reference
to true in your INI file.  However, future versions may not support this
any longer.  in /home/www/ganglia.php on line 273

Finally, I have a small request.  The webfrontend used to include
gmond_started & last_reported in the list of metrics that could be
selected in the cluster view for display/sorting.  Although not really
metrics, this was sometimes useful.  Could they be put back in?  It
looks like the code was changed a lot when the gmetad query speedups
were added, which eliminated these from the list.  I tried looking at
the code myself, but it looks like it would require modifying a lot of
the code and I am not a php expert.

~Jason


-- 
/------------------------------------------------------------------\
|  Jason A. Smith                          Email:  [EMAIL PROTECTED] |
|  Atlas Computing Facility, Bldg. 510M    Phone:  (631)344-4226   |
|  Brookhaven National Lab, P.O. Box 5000  Fax:    (631)344-7616   |
|  Upton, NY 11973-5000                                            |
\------------------------------------------------------------------/

diff -uNr ganglia-webfrontend-2.5.5-dist/ganglia.php ganglia-webfrontend-2.5.5/ganglia.php
--- ganglia-webfrontend-2.5.5-dist/ganglia.php	Mon Nov 10 13:54:16 2003
+++ ganglia-webfrontend-2.5.5/ganglia.php	Fri Jan  2 12:00:45 2004
@@ -270,7 +270,7 @@
             break;
       }
 
-  $fp = fsockopen( $ip, $port, &$errno, &$errstr, $timeout);
+  $fp = fsockopen( $ip, $port, $errno, $errstr, $timeout);
    if (!$fp)
       {
          $error = "fsockopen error: $errstr";
diff -uNr ganglia-webfrontend-2.5.5-dist/functions.php ganglia-webfrontend-2.5.5/functions.php
--- ganglia-webfrontend-2.5.5-dist/functions.php	2003-11-10 13:54:16.000000000 -0500
+++ ganglia-webfrontend-2.5.5/functions.php	2004-06-21 14:57:01.000000000 -0400
@@ -49,9 +49,10 @@
    $uptimeH=intval($uptimeS/3600);
    $uptimeS=$uptimeH ? $uptimeS % ($uptimeH*3600) : $uptimeS;
    $uptimeM=intval($uptimeS/60);
+   $uptimeS=$uptimeM ? $uptimeS % ($uptimeM*60) : $uptimeS;
 
    $s = ($uptimeD!=1) ? "s" : "";
-   return "$uptimeD day$s, $uptimeH:$uptimeM";
+   return sprintf("$uptimeD day$s, %d:%02d:%02d",$uptimeH,$uptimeM,$uptimeS);
 }
 
 #-------------------------------------------------------------------------------
diff -uNr ganglia-webfrontend-2.5.5-dist/host_view.php ganglia-webfrontend-2.5.5/host_view.php
--- ganglia-webfrontend-2.5.5-dist/host_view.php	2003-11-10 13:54:16.000000000 -0500
+++ ganglia-webfrontend-2.5.5/host_view.php	2004-06-21 14:57:18.000000000 -0400
@@ -62,6 +62,12 @@
 $s_metrics[uptime][TYPE] = "string";
 $s_metrics[uptime][VAL] = uptime($cluster[LOCALTIME] - $metrics[boottime][VAL]);
 
+# Add the gmond started timestamps & last reported time (in uptime format) from the HOST tag:
+$s_metrics[gmond_started][TYPE] = "timestamp";
+$s_metrics[gmond_started][VAL] = $hosts_up[GMOND_STARTED];
+$s_metrics[last_reported][TYPE] = "string";
+$s_metrics[last_reported][VAL] = uptime($cluster[LOCALTIME] - $hosts_up[REPORTED]);
+
 # Show string metrics
 if (is_array($s_metrics))
    {

Reply via email to