due_to_source_code_changing_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
due_to_source_code_changing_2 [2013/08/16 15:35]
noskov
— (current)
Line 1: Line 1:
-A few new configuration files were placed in the <GANGLIA HOME>/ directory with the following content: 
-<file php maintenance_conf.php> 
-   <?php 
-$maint_name = "maintenance"; 
  
-$computer_metrics = array( 
-    "load", 
-    "mem", 
-    "cpu" 
-); 
- 
-$maint_rrdfile = array( 
-        "ROWS" => array( 
-                "rows" => "Total_Power.rrd", 
-                "rowscool" => "Calc_total_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_total_lcp_water_flow.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_2" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_3" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_4" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_5" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_6" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_7" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ), 
-        "ROW_8" => array( 
- "rows" => "Total_Row_Power.rrd", 
-                "rowscool" => "Calc_row_lcp_cooling_power.rrd", 
-                "clcpwaterflow" => "Calc_row_lcp_water_flow.rrd", 
-                "rowsfan" => "Calc_row_lcp_fan_power.rrd", 
-                "clcpairflow" => "Calc_row_lcp_water_flow.rrd" 
-        ) 
- 
-); 
- 
-$mgroup_metrics = array( 
- "ROWS" => array( 
- "rows", 
- "rowscool", 
- "clcpwaterflow", 
- "pumptemp", 
- "pumpdp" 
- ), 
- "ROW_6" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ), 
- "ROW_8" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ), 
- "ROW_7" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ), 
- "ROW_2" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ), 
- "ROW_4" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ), 
- "ROW_3" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ), 
- "ROW_5" => array( 
- "rows", 
-                "rowscool", 
- "clcpwaterflow", 
- "clcpairflow", 
- "rowsfan" 
- ) 
- 
-); 
- 
-function add_ipmi_metrics ($metrics, $rrddir){ 
- $alledateien = scandir($rrddir); 
- foreach ($alledateien as $datei) { // Ausgabeschleife 
-                if (substr_compare($datei,"ipmi",0,4) == 0){ 
-                        $dateiinfo = pathinfo($rrddir."/".$datei); 
-                        if($dateiinfo['extension'] == 'rrd'){ 
-                                $metrics[$dateiinfo['filename']]['NAME'] = $dateiinfo['filename']; 
-                                $metrics[$dateiinfo['filename']]['TYPE'] = 'float'; 
-                                $metrics[$dateiinfo['filename']]['VAL'] = 0; 
-                                $metrics[$dateiinfo['filename']]['SLOPE'] = 'both'; 
- $metrics[$dateiinfo['filename']]['UNITS'] = 'a.u.'; 
- $metrics[$dateiinfo['filename']]['GROUP'] = array("ipmi"); 
- #error_log("add ipmii".$dateiinfo['filename']); 
-                        } 
-                } 
-            }; 
- return $metrics; 
-} 
- 
-function add_ipmi_metrics_cview($hostname,$metrics,$rrddir){ 
- $alledateien = scandir($rrddir); 
-        foreach ($alledateien as $datei) { // Ausgabeschleife 
-                if (substr_compare($datei,"ipmi",0,4) == 0){ 
-                        $dateiinfo = pathinfo($rrddir."/".$datei); 
-                        if($dateiinfo['extension'] == 'rrd'){ 
-                                $metrics[$hostname][$dateiinfo['filename']]['NAME'] = $dateiinfo['filename']; 
-                                $metrics[$hostname][$dateiinfo['filename']]['TYPE'] = 'float'; 
-                                $metrics[$hostname][$dateiinfo['filename']]['VAL'] = 0; 
- $metrics[$hostname][$dateiinfo['filename']]['SLOPE'] = 'both'; 
- $metrics[$hostname][$dateiinfo['filename']]['UNITS'] = 'a.u.'; 
-                                $metrics[$hostname][$dateiinfo['filename']]['GROUP'] = array("ipmi"); 
-                                #error_log("add ipmii".$dateiinfo['filename']); 
-                        } 
-                } 
-            }; 
-        return $metrics; 
-} 
-?> 
- 
-</file>    
-in the <GANGLIA HOME>/graph.d/ directory (files archive {{:graph_d.tar.bz2|}}) 
-   
-   4241 Aug 13 18:27 clcpairflow_report.php 
-   4247 Aug 13 18:27 clcpwaterflow_report.php 
-   3011 Feb 17  2010 cpu_report.php 
-   4388 Aug  6 17:06 cputemp_report.php 
-   1481 Feb 17  2010 load_report.php 
-   2284 Feb 17  2010 mem_report.php 
-   3659 Aug 14 11:55 metric.php 
-   6481 Jul 18 16:50 my_report.php 
-   1109 Jul 19 11:52 network_report.php 
-   1107 Feb 17  2010 packet_report.php 
-   4369 Jul 19 16:12 pump1_report.php 
-   4561 Jul 24 14:38 pumpdp_report.php 
-   4752 Jul 24 16:34 pumptemp_report.php 
-   4079 Aug 13 18:26 rows_report.php 
-   4154 Aug 13 18:25 rowscool_report.php 
-   4089 Aug 13 18:26 rowsfan_report.php 
-   6481 Feb 17  2010 sample_report.php 
- 
- 
-correction of the file metric.php in order to take new DS in to account: 
-<file metric.php> 
-... 
-$DSname="sum"; 
-//# the actual graph... 
-    if (substr_compare($metricname,"ipmi",0,4) == 0) 
- $DSname="ipmi"; 
-    $series  = "DEF:'sum'='$rrd_dir/$metricname.rrd:$DSname':AVERAGE "; 
-    $series .= "AREA:'sum'#$default_metric_color:'$subtitle_one'"; 
-    $series .= ":STACK: COMMENT:'$subtitle_two'"; 
-... 
-</file> 
- 
- 
-**in the file conf.php (in "/etc/ganglia/") was inserted:** 
-<code php> 
-... 
-include_once "./maintenance_conf.php"; 
-... 
-# Set timezone 
-date_default_timezone_set ( 'Europe/Berlin' ); 
-... 
-</code> 
- 
-in the template file <GANGLIA HOME>/templates/default/meta_view.tpl the block "public" was changed: 
- 
-<code php> 
-... 
-<!-- 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 --> 
-... 
-</code> 
- 
-in the file <GANGLIA HOME>/meta_view.php the following was changed: 
-<code php 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)); 
-         } 
-   } 
-... 
-</code> 
-in order to see the "last reported" metric by default in the "maintenance" overview the line 118 was changed: 
-<code php> 
-if ($name == $maint_name) 
-          $tpl->assign("url", "./?c=$name&amp;m=last_reported&amp;r=$range"); 
-      else 
-          $tpl->assign("url", $url); 
-</code> 
  • due_to_source_code_changing_2.1376660110.txt.gz
  • Last modified: 2013/08/16 15:35
  • by noskov