All pastes #732147 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-10-10 18:19 UTC
rendered paste body
Index: graph.php
===================================================================
--- graph.php	(revision 852)
+++ graph.php	(working copy)
@@ -27,6 +27,8 @@
 	escapeshellcmd( rawurldecode( $_GET["vl"] )) : NULL;
 $sourcetime = isset($_GET["st"]) ?
 	escapeshellcmd($_GET["st"]) : NULL;
+$summary = isset($_GET["su"]) ? 
+    escapeshellcmd($_GET["su"]) : NULL;
 
 # RFM - Define these variables to avoid "Undefined variable" errors being 
 # reported in ssl_error_log.
@@ -54,6 +56,14 @@
       $fudge_1 = 14;
       $fudge_2 = 28;
     }
+else if ($size == "large")
+    {
+      $height = 600;
+      $width = 800;
+      $fudge_0 = 0;
+      $fudge_1 = 0;
+      $fudge_2 = 0;
+    }
 else
     {
       $height = 100;
@@ -240,7 +276,7 @@
       $subtitle = $metricname;
       if ($context == "host") 
       {
-          if ($size == "small")
+          if ($summary)
               $prefix = $metricname;
           else
               $prefix = $hostname;
@@ -292,16 +328,16 @@
    }
 else
    {
+    # Value for this graph define a background color.
+    if (!$load_color) $load_color = "ffffff";
+    $background = "--color BACK#'$load_color'";
+
     if ($size == "small")
-      {
-        # Value for this graph define a background color.
-        if (!$load_color) $load_color = "ffffff";
-        $background = "--color BACK#'$load_color'";
-
         $title = $hostname;
-      }
     else if ($style)
        $title = "$hostname $style last $range";
+    else if ($summary)
+       $title = "$hostname";
     else
        $title = $metricname;
    }
Index: templates/default/cluster_view.tpl
===================================================================
--- templates/default/cluster_view.tpl	(revision 852)
+++ templates/default/cluster_view.tpl	(working copy)
@@ -58,6 +58,7 @@
   |
    <FONT SIZE="-1">
    Columns&nbsp;&nbsp;{cols_menu}
+   Size&nbsp;&nbsp;{size_menu}
    </FONT>
   </TD>
 </TR>
Index: cluster_view.php
===================================================================
--- cluster_view.php	(revision 852)
+++ cluster_view.php	(working copy)
@@ -71,8 +71,10 @@
 $tpl->assign("sort", $sort);
 $tpl->assign("range", $range);
 # Host columns menu defined in header.php
-if ($showhosts)
+if ($showhosts) {
   $tpl->assign("cols_menu", $cols_menu);
+  $tpl->assign("size_menu", $size_menu);
+}
 $tpl->assign("checked$showhosts", "checked");
 
 $sorted_hosts = array();
@@ -211,12 +213,13 @@
             else
                {
                   $load_color = load_color($host_load[$host]);
+                  $size = isset($clustergraphsize) ? $clustergraphsize : 'small';
                   $graphargs = (isset($reports[$metricname]) and
                                 $reports[$metricname]) ?
                         "g=$metricname&amp;" : "m=$metricname&amp;";
-                  $graphargs .= "z=small&amp;c=$cluster_url&amp;h=$host_url"
+                  $graphargs .= "z=$size&amp;c=$cluster_url&amp;h=$host_url"
                      ."&amp;l=$load_color&amp;v=$val[VAL]&amp;x=$max&amp;n=$min"
-                     ."&amp;r=$range&amp;st=$cluster[LOCALTIME]";
+                     ."&amp;r=$range&amp;su=1&amp;st=$cluster[LOCALTIME]";
                }
          }
 
Index: get_context.php
===================================================================
--- get_context.php	(revision 852)
+++ get_context.php	(working copy)
@@ -37,6 +37,9 @@
 # The direction we are travelling in the grid tree
 $gridwalk = isset($_GET["gw"]) ?
 	escapeshellcmd($_GET["gw"]) : NULL;
+# Size oft he host graphs in the cluster view
+$clustergraphsize = isset($_GET["z"]) ?
+    escapeshellcmd($_GET["z"]) : NULL;
 # A stack of grid parents. Prefer a GET variable, default to cookie.
 if (isset($_GET["gs"]) and $_GET["gs"])
       $gridstack = explode(">", rawurldecode($_GET["gs"]));
Index: header.php
===================================================================
--- header.php	(revision 852)
+++ header.php	(working copy)
@@ -334,7 +334,19 @@
             $cols_menu .= ">$cols\n";
          }
       $cols_menu .= "</SELECT>\n";
-
+      
+      $size_menu = '<SELECT NAME="z" OnChange="ganglia_form.submit();">';
+      
+      $size_arr = array("small","medium","large");
+      foreach ($size_arr as $size) {
+          $size_menu .= "<OPTION VALUE=\"$size\"";
+          if (isset($clustergraphsize) && ($size === $clustergraphsize)) {
+              $size_menu .= " SELECTED";
+          }
+          $size_menu .= ">$size</OPTION>\n";
+      }
+      $size_menu .= "</SELECT>\n";
+  
       # Assign template variable in cluster view.
    }