let Grid and Cluster Load graphs at the web 2.0 interface lock like at the old interface #13

Merged
merged 3 commits into from Apr 20, 2011
@@ -1,5 +1,5 @@
<?php
-# $Id: conf_default.php.in 2545 2011-03-30 02:16:47Z vvuksan $
+# $Id: conf_default.php.in 2557 2011-04-11 01:51:43Z vvuksan $
#
# Gmetad-webfrontend version. Used to check for updates.
#
@@ -121,11 +121,6 @@ $conf['proc_run_color'] = "0000FF";
$conf['cpu_num_color'] = "FF0000";
$conf['num_nodes_color'] = "00FF00";
-#
-# Display number of cores in LOAD report graph
-#
-$conf['show_cores'] = false;
-
# Other colors
$conf['jobstart_color'] = "ff3300";
@@ -867,10 +867,13 @@ function build_rrdtool_args_from_json( &$rrdtool_graph, $graph_config ) {
// Available line types
$line_widths = array("1","2","3");
-
+
// Loop through all the graph items
foreach( $graph_config[ 'series' ] as $index => $item ) {
-
+ // ignore item if context is not defined in json template
+ if ( isSet($item[ 'contexts' ]) and in_array($context, $item['contexts'])==false )
+ continue;
+
$rrd_dir = $conf['rrds'] . "/" . $item['clustername'] . "/" . $item['hostname'];
$metric = sanitize( $item[ 'metric' ] );
@@ -884,11 +887,17 @@ function build_rrdtool_args_from_json( &$rrdtool_graph, $graph_config ) {
$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";
-
+
// TODO sanitize color
switch ( $item_type ) {
@@ -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", "contexts": [ "cluster", "meta" ] },
+ { "metric": "cpu_num", "color": "FF0000", "label": "CPUs", "line_width": "2", "type": "line" },
{ "metric": "proc_run", "color": "2030F4", "label": "Procs", "line_width": "2", "type": "line" }
]
}
@@ -78,7 +78,7 @@
print '<div class="img_view">' .
'<a href="./graph.php?r=' . $key . $query_string .'&csv=1"><img alt="Export to CSV" height=16 width=16 src="img/csv.png"></a> ' .
'<a href="./graph.php?r=' . $key . $query_string .'&json=1"><img alt="Export to JSON" height=16 width=16 src="img/js.png"></a>' .
- '<br /><img alt="Last ' . $key . '" src="graph.php?r=' . $key . '&z=' . $largesize . $query_string . '"></div>';
+ '<br /><a href="./graph.php?r=' . $key . '&z=' . $xlargesize . $query_string . '"><img alt="Last ' . $key . '" src="graph.php?r=' . $key . '&z=' . $largesize . $query_string . '"></a></div>';
}
// The div below needs to be added to clear float left since in aggregate view things
@@ -45,21 +45,21 @@
{if isset($source.self_summary_graphs)}
<TD ALIGN="RIGHT" VALIGN="TOP">
- <A HREF="./graph.php?{$source.graph_url}&amp;g=load_report&amp;z=large">
+ <A HREF="./graph_all_periods.php?{$source.graph_url}&amp;g=load_report&amp;z=large">
<IMG SRC="./graph.php?{$source.graph_url}&amp;g=load_report&amp;z=medium"
ALT="{$source.name} LOAD" BORDER="0">
</A><BR>
- <A HREF="./graph.php?{$source.graph_url}&amp;g=cpu_report&amp;z=large">
+ <A HREF="./graph_all_periods.php?{$source.graph_url}&amp;g=cpu_report&amp;z=large">
<IMG SRC="./graph.php?{$source.graph_url}&amp;g=cpu_report&amp;z=medium"
ALT="{$source.name} CPU" BORDER="0">
</A>
</TD>
<TD VALIGN="TOP">
- <A HREF="./graph.php?{$source.graph_url}&amp;g=mem_report&amp;z=large">
+ <A HREF="./graph_all_periods.php?{$source.graph_url}&amp;g=mem_report&amp;z=large">
<IMG SRC="./graph.php?{$source.graph_url}&amp;g=mem_report&amp;z=medium"
ALT="{$source.name} MEM" BORDER="0">
</A><BR>
- <A HREF="./graph.php?{$source.graph_url}&amp;g=network_report&amp;z=large">
+ <A HREF="./graph_all_periods.php?{$source.graph_url}&amp;g=network_report&amp;z=large">
<IMG SRC="./graph.php?{$source.graph_url}&amp;g=network_report&amp;z=medium"
ALT="{$source.name} NETWORK" BORDER="0">
</A>