User Tools

Site Tools


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",
    "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;
}
?>

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:

...
$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'";
...

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

...
include_once "./maintenance_conf.php";
...
# Set timezone
date_default_timezone_set ( 'Europe/Berlin' );
...

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>
 
    <table cellspacing=1 cellpadding=1 width=100% border=0>
  <!-- START BLOCK : graph_group -->
     <tr>
       <td>
  <!-- START BLOCK : metric_graphs -->
          <A HREF="{url}">
             <IMG SRC="./graph.php?{graph_url}&g={metricname}_report&maint={m_name}&z=smedium&r={range}"
              ALT="{name} Load" BORDER="0">
           </A>
  <!-- END BLOCK : metric_graphs -->
       </td>
     </tr>
  <!-- END BLOCK : graph_group -->
  </table>
 
   </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 ($mgroup_metrics as $mname => &$mgrp) {
		  $hostname = $mname;
                  $tpl->newBlock("graph_group");
                  foreach ($mgrp as $g) {
                      $tpl->newBlock("metric_graphs");
 
                      $tpl->assign("range", $range);
                      $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 {
                 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']);
		 $tpl->newBlock("graph_group");
                 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);
                 }
             }
 
...

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);

in order to list new IPMI metrics additionally in the cluster overview page the function start_cluster was changed to ganglia.php

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;
      }
}
...
due_to_source_code_changing_2.1376661007.txt.gz · Last modified: 2013/08/16 15:50 by noskov