due_to_source_code_changing_2

This is an old revision of the document!


A few new configuration files were placed in the <GANGLIA HOME>/ directory with the following content:

maintenance_conf.php
   <?php
   $maint_name = "maintenance";
   $computer_metrics = array(
     "load",
     "mem"
   );
   $maintenance_metrics = array(
     "rows",
     "rowscool",
     "clcpwaterflow",
     "pumptemp",
     "pumpdp"
   );
   ?>

in the <GANGLIA HOME>/graph.d/ directory (files archive graph_d.zip)

 **pumpdp_report.php**
 **pumptemp_report.php**
 **rows_report.php**
 **rowscool_report.php**
 **clcpwaterflow_report.php**

in the file conf.php (in “/etc/ganglia/”) was inserted:

include_once "./maintenance_conf.php";

in the template file <GANGLIA HOME>/templates/default/meta_view.tpl the block “public” was changed:

...
<!-- START BLOCK : public -->
 <TD ALIGN="LEFT" VALIGN="TOP">
<table cellspacing=1 cellpadding=1 width="100%" border=0>
 <tr><td>CPUs Total:</td><td align=left><B>{cpu_num}</B></td></tr>
 <tr><td width="80%">Hosts up:</td><td align=left><B>{num_nodes}</B></td></tr>
 <tr><td>Hosts down:</td><td align=left><B>{num_dead_nodes}</B></td></tr>
 <tr><td>&nbsp;</td></tr>
 <tr><td class=footer colspan=2>{cluster_load}</td></tr>
 <tr><td class=footer colspan=2>{localtime}</td></tr>
</table>
  </TD>
 
  <TD ROWSPAN=2 ALIGN="CENTER" VALIGN=top>
 
  <!-- START BLOCK : metric_graphs -->
  <A HREF="{url}">
   <IMG SRC="./graph.php?{graph_url}&g={metricname}_report&z=medium&r={range}"
       ALT="{name} Load" BORDER="0">
  </A>
  <!-- END BLOCK : metric_graphs -->
 
   </TD>
<!-- END BLOCK : public -->
...

in the file <GANGLIA HOME>/meta_view.php the following was changed:

public cluster code is altered
...
foreach ( $sorted_sources as $source => $val )
  {
 
...
    if (!isset($private[$source]) or !$private[$source]) 
         {
            $tpl->assign("alt_view", "<FONT SIZE=\"-2\">$alt_url</FONT>");
            # Each block has a different namespace, so we need to redefine variables.
            $tpl->newBlock("public");
            if ($localtime)
               $tpl->assign("localtime",  "<font size=-1>Localtime:</font><br>&nbsp;&nbsp;" 
                  . date("Y-m-d H:i", $localtime) );
 
             $tpl->assign("num_nodes", $grid[$source]["HOSTS_UP"] );
             $tpl->assign("num_dead_nodes", $grid[$source]["HOSTS_DOWN"] );
 
 
             if ($name == $maint_name){
                 foreach ($maintenance_metrics as $g) {
                     $tpl->newBlock("metric_graphs");
 
                     $tpl->assign("range", $range);
                     $tpl->assign("name", $name );
                     $tpl->assign("url", "./graph.php?c=$cluster_url&amp;r=$range&amp;g=${g}_report&amp;z=large");
                     $tpl->assign("graph_url", $graph_url);
                     $tpl->assign("metricname", $g);
                 }
 
             } else {
                 if ($cluster_load)
                     $tpl->assign("cluster_load", "<font size=-1>Avg Load (15, 5, 1m):</font>"
                                  ."<br>&nbsp;&nbsp;$cluster_load");
                 $tpl->assign("cpu_num", $m["cpu_num"]['SUM']);
                 foreach ($computer_metrics as $g) {
 
                     $tpl->newBlock("metric_graphs");
 
                     $tpl->assign("range", $range);
                     $tpl->assign("name", $name );
                     $tpl->assign("url", $url);
                     $tpl->assign("graph_url", $graph_url);
                     $tpl->assign("metricname", $g);
                 }
             }
 
 
	    if(isset($base64img)) {
                $tpl->assign("base64img", $base64img);
	    }
         }
      else 
         {
            $tpl->newBlock("private");
            $tpl->assign("num_nodes", $grid[$source]["HOSTS_UP"] + $grid[$source]["HOSTS_DOWN"] );
            $tpl->assign("cpu_num", $m["cpu_num"]['SUM']);
            if ($localtime)
               $tpl->assign("localtime", "<font size=-1>Localtime:</font><br>&nbsp;&nbsp;"
                  . date("Y-m-d H:i",$localtime));
         }
   }
...

in order to see the “last reported” metric by default in the “maintenance” overview the line 118 was changed:

if ($name == $maint_name)
          $tpl->assign("url", "./?c=$name&amp;m=last_reported&amp;r=$range");
      else
          $tpl->assign("url", $url);
  • due_to_source_code_changing_2.1374841948.txt.gz
  • Last modified: 2013/07/26 14:32
  • by noskov