I have a question regarding the PHP web code of Ganglia:

My setup looks like that:

   * I have one Grid and several Clusters.
   * Each Cluster has between 10-250 nodes, all running on AIX LPARs
     (but the question is independent of the OS).
   * I have clustered on a logical level, i.e., not according to the
     different hardware systems but for instance, all SAP systems, all
     TSM systems etc.
   * I have lots of additional metrics, provided via a C-DSO.
   * One of the additional metrics is a system-identifier, i.e., a
     hardware identifier that I want to use to identify the hardware
     that each LPAR is running on.


Now in addition to the logical view I want to introduce a "physical view", i.e., a view of all LPARs running on a specific system with a certain hardware identifier. This is were my illiteracy regarding PHP comes into play.

Basically, I want to have a list of ALL Ganglia nodes so that I can loop over and group them according to their hardware identifier.

I was able to accomplish someting in cluster_view.php with the following code snippet but have failed miserably so far in meta_view.php.

----------------------------------------------------------------

$sysids = array();
$sysid_count = 0;
foreach ($metrics as $host => $val)
{
   if (isset( $val["serial_num"]['VAL'] ))
   {
      $id = $val["serial_num"]['VAL'];
      if (! in_array( $id, $sysids ))
      {
         $sysids[$sysid_count] = $id;
         $sysid_count++;
      }
   }
}
sort( $sysids );

$cv = @fopen("/tmp/cv.txt","w");
foreach ($hosts_up as $host => $val)
{
   fputs($cv,"$host\n");
}

fputs($cv,"=================================================\n");
fputs($cv,"sysid_count = $sysid_count\n");
fputs($cv,"=================================================\n");

foreach ($sysids as $id)
{
   fputs($cv,"$id\n");
}
fputs($cv,"=================================================\n");

foreach ($sysids as $id)
{
   fputs($cv,"-------> $id\n");
   foreach ($hosts_up as $host => $h)
   {
      if ( $metrics[$host]["serial_num"]['VAL'] == $id )
      {
         fputs($cv,"$host\n");
      }
   }
}

fclose($cv);

----------------------------------------------------------------

Any help/hints regarding how a loop over all Ganglia nodes can be accomplished in metaview.php would be highly welcome. Thanks.

Regards,
Michael
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to