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/07/26 14:32]
noskov
due_to_source_code_changing_2 [2021/09/14 14:55]
jrutte02 removed
Line 2: Line 2:
 <file php maintenance_conf.php> <file php maintenance_conf.php>
    <?php    <?php
-   $maint_name = "maintenance"; +$maint_name = "maintenance"; 
-   $computer_metrics = array( + 
-     "load", +$computer_metrics = array( 
-     "mem" +    "load", 
-   ); +    "mem", 
-   $maintenance_metrics = array( +    "cpu
-     "rows", +); 
-     "rowscool", + 
-     "clcpwaterflow", +$maint_rrdfile = array( 
-     "pumptemp", +        "ROWS" => array( 
-     "pumpdp" +                "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>    </file>   
-in the <GANGLIA HOME>/graph.d/ directory (files archive {{:graph_d.zip|}})+in the <GANGLIA HOME>/graph.d/ directory (files archive {{:graph_d.tar.bz2|}})
      
-   **pumpdp_report.php** +   4241 Aug 13 18:27 clcpairflow_report.php 
-   **pumptemp_report.php** +   4247 Aug 13 18:27 clcpwaterflow_report.php 
-   **rows_report.php** +   3011 Feb 17  2010 cpu_report.php 
-   **rowscool_report.php** +   4388 Aug  6 17:06 cputemp_report.php 
-   **clcpwaterflow_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:** **in the file conf.php (in "/etc/ganglia/") was inserted:**
 <code php> <code php>
 +...
 include_once "./maintenance_conf.php"; include_once "./maintenance_conf.php";
 +...
 +# Set timezone
 +date_default_timezone_set ( 'Europe/Berlin' );
 +...
 </code> </code>
  
Line 47: Line 232:
   <TD ROWSPAN=2 ALIGN="CENTER" VALIGN=top>   <TD ROWSPAN=2 ALIGN="CENTER" VALIGN=top>
      
 +    <table cellspacing=1 cellpadding=1 width=100% border=0>
 +  <!-- START BLOCK : graph_group -->
 +     <tr>
 +       <td>
   <!-- START BLOCK : metric_graphs -->   <!-- START BLOCK : metric_graphs -->
-  <A HREF="{url}"> +          <A HREF="{url}"> 
-   <IMG SRC="./graph.php?{graph_url}&g={metricname}_report&z=medium&r={range}" +             <IMG SRC="./graph.php?{graph_url}&g={metricname}_report&maint={m_name}&z=smedium&r={range}" 
-       ALT="{name} Load" BORDER="0"> +              ALT="{name} Load" BORDER="0"> 
-  </A>+           </A>
   <!-- END BLOCK : metric_graphs -->   <!-- END BLOCK : metric_graphs -->
 +       </td>
 +     </tr>
 +  <!-- END BLOCK : graph_group -->
 +  </table>
      
    </TD>    </TD>
Line 80: Line 273:
                          
              if ($name == $maint_name){              if ($name == $maint_name){
-                 foreach ($maintenance_metrics as $g) { + foreach ($mgroup_metrics as $mname => &$mgrp) { 
-                     $tpl->newBlock("metric_graphs"); +   $hostname = $mname; 
-                      +                  $tpl->newBlock("graph_group"); 
-                     $tpl->assign("range", $range); +                  foreach ($mgrp as $g) { 
-                     $tpl->assign("name", $name ); +                      $tpl->newBlock("metric_graphs"); 
-                     $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("range", $range); 
-                     $tpl->assign("metricname", $g);+                      $tpl->assign("name", $name ); 
 +       $tpl->assign("m_name", $hostname ); 
 +                      $tpl->assign("url", "./graph.php?c=$name&amp;r=$range&amp;g=${g}_report&amp;maint=${hostname}&amp;z=large"); 
 +                      $tpl->assign("graph_url", $graph_url); 
 +                      $tpl->assign("metricname", $g); 
 +                  }
                  }                  }
-                  
              } else {              } else {
                  if ($cluster_load)                  if ($cluster_load)
Line 95: Line 292:
                                   ."<br>&nbsp;&nbsp;$cluster_load");                                   ."<br>&nbsp;&nbsp;$cluster_load");
                  $tpl->assign("cpu_num", $m["cpu_num"]['SUM']);                  $tpl->assign("cpu_num", $m["cpu_num"]['SUM']);
 + $tpl->newBlock("graph_group");
                  foreach ($computer_metrics as $g) {                  foreach ($computer_metrics as $g) {
                                            
Line 106: Line 304:
                  }                  }
              }              }
-             +
-             +
-     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> </code>
Line 131: Line 314:
           $tpl->assign("url", $url);           $tpl->assign("url", $url);
 </code> </code>
 +
 +in order to list new IPMI metrics additionally in the cluster overview page the function start_cluster was changed to ganglia.php
 +<file changing ganglia.php>
 +...
 +function start_cluster ($parser, $tagname, $attrs)
 +{
 +   global $clustername, $rrds, $metrics, $cluster, $self, $grid, $hosts_up, $hosts_down;
 +   static $hostname;
 +
 +   switch ($tagname)
 +      {
 +         case "GANGLIA_XML":
 +            preamble($attrs);
 +            break;
 +         case "GRID":
 +            $self = $attrs['NAME'];
 +            $grid = $attrs;
 +            break;
 +
 +         case "CLUSTER":
 +            $cluster = $attrs;
 +            break;
 +
 +         case "HOST":
 +            $hostname = $attrs['NAME'];
 +
 +            if (host_alive($attrs, $cluster))
 +               {
 +   isset($cluster['HOSTS_UP']) or $cluster['HOSTS_UP'] = 0;
 +                  $cluster['HOSTS_UP']++;
 +                  $hosts_up[$hostname] = $attrs;
 +               }
 +            else
 +               {
 +   isset($cluster['HOSTS_DOWN']) or $cluster['HOSTS_DOWN'] = 0;
 +                  $cluster['HOSTS_DOWN']++;
 +                  $hosts_down[$hostname] = $attrs;
 +               }
 +            # Pseudo metrics - add useful HOST attributes like gmond_started & last_reported to the metrics list:
 +            $metrics[$hostname]['gmond_started']['NAME'] = "GMOND_STARTED";
 +            $metrics[$hostname]['gmond_started']['VAL'] = $attrs['GMOND_STARTED'];
 +            $metrics[$hostname]['gmond_started']['TYPE'] = "timestamp";
 +            $metrics[$hostname]['last_reported']['NAME'] = "REPORTED";
 +            $metrics[$hostname]['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $attrs['REPORTED']);
 +            $metrics[$hostname]['last_reported']['TYPE'] = "string";
 +            $metrics[$hostname]['ip_address']['NAME'] = "IP";
 +            $metrics[$hostname]['ip_address']['VAL'] = $attrs['IP'];
 +            $metrics[$hostname]['ip_address']['TYPE'] = "string";
 +            $metrics[$hostname]['location']['NAME'] = "LOCATION";
 +            $metrics[$hostname]['location']['VAL'] = $attrs['LOCATION'];
 +            $metrics[$hostname]['location']['TYPE'] = "string";
 +
 +     /* Addition of IPMI metrics */
 +     $rrddir = "$rrds/$clustername/$hostname";
 +     $metrics=add_ipmi_metrics_cview($hostname,$metrics,$rrddir);
 +     #error_log("rrd= $rrddir");
 +
 +            break;
 +
 +         case "METRIC":
 +            $metricname = $attrs['NAME'];
 +            $metrics[$hostname][$metricname] = $attrs;
 +            break;
 +
 +         default:
 +            break;
 +      }
 +}
 +...
 +</file>
 +
 +in order to see the IPMI metrics in the host overview the file host_view.php was changed as following:
 +<file host_view.php>
 +...
 +$g_metrics_group = array();
 +
 +/* Addition of IPMI metrics */
 +$rrddir = "$rrds/$clustername/$hostname";
 +$metrics=add_ipmi_metrics($metrics,$rrddir);
 +...
 +</file>