Attached is a patch to let the Grid and Cluster Load graphs lock like at the 
old interface.

Add possibility to define a custom data source in the json template with DS 
which will get used instead of the default 'sum'. To handle situations where 
the data source is not available in all rrds define the context.

For example the number of Nodes:
data source 'num' only available in the summary rrds of 'cpu_num'
definition in the json template looks like:
{ "metric": "cpu_num", "color": "00FF00", "label": "Nodes", "line_width": "2", 
"type": "line", "DS": "num", "context": 
{ "cluster": true, "meta": true } }
The metric will get ignored at the host context but not at the meta and 
cluster context.


Markus
-- 
Markus Köberl
Graz University of Technology
Signal Processing and Speech Communication Laboratory
E-mail: markus.koeb...@tugraz.at
Index: graph.d/load_report.json
===================================================================
--- graph.d/load_report.json	(revision 2574)
+++ graph.d/load_report.json	(working copy)
@@ -5,6 +5,8 @@
    "vertical_label" : "Loads/Procs",
    "series" : [
       { "metric": "load_one", "color": "BBBBBB", "label": "1-min", "type": "stack" },
+      { "metric": "cpu_num", "color": "00FF00", "label": "Nodes", "line_width": "2", "type": "line", "DS": "num", "context": { "cluster": true, "meta": true } },
+      { "metric": "cpu_num", "color": "FF0000", "label": "CPUs", "line_width": "2", "type": "line" },
       { "metric": "proc_run", "color": "2030F4", "label": "Procs", "line_width": "2", "type": "line" }
    ]
 }
Index: functions.php
===================================================================
--- functions.php	(revision 2574)
+++ functions.php	(working copy)
@@ -870,7 +870,10 @@

   // Loop through all the graph items
   foreach( $graph_config[ 'series' ] as $index => $item ) {
-
+     // ignore item if context is not defined in json template
+     if ( $item[ 'context' ] and $item[ 'context' ][ $context ] == false )
+         continue;
+
      $rrd_dir = $conf['rrds'] . "/" . $item['clustername'] . "/" . $item['hostname'];

      $metric = sanitize( $item[ 'metric' ] );
@@ -884,8 +887,14 @@
       $unique_id = "a" . $index;

        $label = str_pad( sanitize( $item[ 'label' ] ), $max_label_length );
-       $series .= " DEF:'$unique_id'='$metric_file':'sum':AVERAGE ";
-
+
+       // use custom DS defined in json template (default = 'sum')
+       $DS = sanitize( $item[ 'DS' ] );
+       if($DS!='')
+           $series .= " DEF:'$unique_id'='$metric_file':'$DS':AVERAGE ";
+       else
+           $series .= " DEF:'$unique_id'='$metric_file':'sum':AVERAGE ";
+
        // By default graph is a line graph
        isset( $item['type']) ? $item_type = $item['type'] : $item_type = "line";
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to