diff -ur cacti-0.8.6b-orig/lib/graph_variables.php cacti-0.8.6b/lib/graph_variables.php --- cacti-0.8.6b-orig/lib/graph_variables.php 2004-10-27 01:32:56.000000000 +0200 +++ cacti-0.8.6b/lib/graph_variables.php 2004-10-27 01:26:19.000000000 +0200 @@ -78,7 +78,7 @@ @arg $ds_steps - how many seconds each period represents @returns - (array) an array containing each data source item, and its sum */ function bandwidth_summation($local_data_id, $start_time, $end_time, $rra_steps, $ds_steps) { - $fetch_array = rrdtool_function_fetch($local_data_id, $start_time, $end_time); + $fetch_array = rrdtool_function_fetch($local_data_id, $start_time, $end_time, $rra_steps * $ds_steps); if ((!isset($fetch_array["data_source_names"])) || (count($fetch_array["data_source_names"]) == 0)) { return; diff -ur cacti-0.8.6b-orig/lib/rrd.php cacti-0.8.6b/lib/rrd.php --- cacti-0.8.6b-orig/lib/rrd.php 2004-10-27 01:32:56.000000000 +0200 +++ cacti-0.8.6b/lib/rrd.php 2004-10-27 01:31:52.000000000 +0200 @@ -315,7 +315,7 @@ @returns - (array) an array containing all data in this data source broken down by each data source item. the maximum of all data source items is included in an item called 'ninety_fifth_percentile_maximum' */ -function &rrdtool_function_fetch($local_data_id, $start_time, $end_time) { +function &rrdtool_function_fetch($local_data_id, $start_time, $end_time, $resolution = 0) { if (empty($local_data_id)) { return; } @@ -326,7 +326,11 @@ $data_source_path = get_data_source_path($local_data_id, true); /* build and run the rrdtool fetch command with all of our data */ - $output = rrdtool_execute("fetch $data_source_path AVERAGE -s $start_time -e $end_time", false, RRDTOOL_OUTPUT_STDOUT); + $cmd_line = "fetch $data_source_path AVERAGE -s $start_time -e $end_time"; + if ($resolution > 0) { + $cmd_line .= " -r $resolution"; + } + $output = rrdtool_execute($cmd_line, false, RRDTOOL_OUTPUT_STDOUT); /* grab the first line of the output which contains a list of data sources in this .rrd file */