I've done this on the cluster and host level with a small hack.  Note
that this DOES NOT WORK with the latest trunk code, as I've not fully
updated it to use the Dwoo template engine.  It probably won't work on
your system either. :)  However, you should be able to get the gist of
it.

Note that there are two different ways of "choosing" what graphs to
show.  One a a looong set of if/else blocks.  The other (more elegant,
IMO) uses regexes.  Take your pick....

On Fri, Oct 8, 2010 at 15:03, CHU, STEPHEN H (ATTSI) <[email protected]> wrote:
> Hi all,
>
>
>
> I have set up 3 different clusters all homed in to a gmetad server and
> served by a webfrontend. One of the cluster is a Lustre file system with 6
> servers. To gather Lustre specific data I use collectl which supports
> exporting Lustre data to Ganglia. Collectl is running on each of the Lustre
> server alongside with gmond. Collectl feeds exported XML data to gmond UDP
> port and the rrd data get delivered back to the gmetad server. I like to
> display these data but they don’t belong to any metrics defined. After
> reading up on how to generate custom graphs, I have successfully created
> graphs for them (keying on some existing metrics like bytes_in/bytes_out)
> and they are displayed under the Lustre cluster page. However, when I select
> the other clusters, they are also being “shown” with no graphs but with the
> name of the custom graph report. That’s understandable since they don’t have
> any of the Lustre data.
>
>
>
> Under conf.php, the Lustre custom graphs are included under the
> $optional_graphs array assignment.
>
>
>
> My question: is there a way/option/method to specify the optional graphs
> will only show up under a specific cluster? I only want to see the custom
> graphs for the Lustre cluster and not the other two.
>
>
>
> Any suggestions are appreciated. Thanks.
>
>
>
> Steve
>
>
>
> Stephen Chu
>
> AT&T Labs CSO
>
> Middletown, NJ
>
> ------------------------------------------------------------------------------
> 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/beautyoftheweb
> _______________________________________________
> Ganglia-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ganglia-general
>
>



-- 
Jesse Becker
Index: cluster_view.php
===================================================================
--- cluster_view.php	(revision 2344)
+++ cluster_view.php	(working copy)
@@ -60,10 +60,29 @@
 $data->assign("graph_args", $graph_args);
 if (!isset($optional_graphs))
   $optional_graphs = array();
-$optional_graphs_data = array();
+
 foreach ($optional_graphs as $g) {
-  $optional_graphs_data[$g]['name'] = $g;
-  $optional_graphs_data[$g]['graph_args'] = $graph_args;
+
+    $make_graph = ( preg_match('/_Nodes/',  $clustername)  and  preg_match('/(temp|jobqueue)/',      $g) )  ? 1 :
+                  ( preg_match('/_Storage/',$clustername)  and  preg_match('/(storage|nfs|coraid)/', $g) )  ? 1 :
+                  0;
+
+    # refactor to a terneary chain...
+#    if     ( $clustername == "GC_Nodes"     and  $g == "temp" )     { $make_graph = 1; }
+#    elseif ( $clustername == "GC_Nodes"     and  $g == "jobqueue" ) { $make_graph = 1; }
+#    elseif ( $clustername == "GC_Storage"   and  $g == "storage" )  { $make_graph = 1; }
+#    elseif ( $clustername == "GC_Storage"   and  $g == "nfs" )      { $make_graph = 1; }
+#    elseif ( $clustername == "GC_Storage"   and  $g == "coraid" )   { $make_graph = 1; }
+#    elseif ( $clustername == "Trek_Storage" and  $g == "storage" )  { $make_graph = 1; }
+#    elseif ( $clustername == "Trek_Storage" and  $g == "nfs" )      { $make_graph = 1; }
+#    elseif ( $clustername == "Trek_Storage" and  $g == "coraid" )   { $make_graph = 1; }
+
+    if ($make_graph) {
+        $tpl->newBlock('optional_graphs');
+        $tpl->assign('name',$g);
+        $tpl->assign('graph_args',$graph_args);
+        $tpl->gotoBlock('_ROOT');
+    }
 }
 $data->assign('optional_graphs_data', $optional_graphs_data);
 
Index: host_view.php
===================================================================
--- host_view.php	(revision 2344)
+++ host_view.php	(working copy)
@@ -20,6 +20,10 @@
 $data->assign("cluster_url", $cluster_url);
 $data->assign("graphargs", "h=$hostname&amp;$get_metric_string&amp;st=$cluster[LOCALTIME]");
 
+$graphargs = "h=$hostname&amp;$get_metric_string&amp;st=$cluster[LOCALTIME]";
+
+$tpl->assign("graphargs", $graphargs);
+
 # For the node view link.
 $data->assign("node_view","./?p=2&amp;c=$cluster_url&amp;h=$hostname");
 
@@ -30,10 +34,36 @@
       return;
    }
 
+foreach ($optional_graphs as $g) {
+
+    $make_graph = 0;
+
+    # refactor to a terneary chain...
+    $make_graph = ( preg_match('/_Storage/',$clustername)  and  preg_match('/(nfs|coraid)/', $g) )  
+                    ? 1
+                    : 0;
+    if     ( $clustername == "GC_Storage"   and  $g == "nfs" )      { $make_graph = 1; }
+    elseif ( $clustername == "GC_Storage"   and  $g == "coraid" )   { $make_graph = 1; }
+    elseif ( $clustername == "Trek_Storage" and  $g == "nfs" )      { $make_graph = 1; }
+    elseif ( $clustername == "Trek_Storage" and  $g == "coraid" )   { $make_graph = 1; }
+
+    $opt_graphargs = "h=$hostname&amp;m=load_report&amp;st=$cluster[LOCALTIME]&amp;c=$clustername";
+    
+    if ($make_graph) {
+        $data->newBlock('optional_graphs');
+        $data->assign('opt_name',$g);
+        $data->assign('opt_graphargs',$opt_graphargs);
+        $data->gotoBlock('_ROOT');
+    }
+}
+
+
+
 $data->assign("ip", $hosts_up['IP']);
 $data->assign('columns_dropdown', 1);
 $data->assign("metric_cols_menu", $metric_cols_menu);
 $data->assign("size_menu", $size_menu);
+
 $g_metrics_group = array();
 
 foreach ($metrics as $name => $v)
------------------------------------------------------------------------------
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/beautyoftheweb
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to