diff --git a/html/collectd-graph.php b/html/collectd-graph.php
index cf6c5e5861..e74b5dd28b 100755
--- a/html/collectd-graph.php
+++ b/html/collectd-graph.php
@@ -209,6 +209,14 @@ if (isset($MetaGraphDefs[$type])) {
$rrd_cmd = collectd_draw_rrd($host, $plugin, $pinst, $type, $tinst);
}
+if(isset($rrd_cmd))
+{
+ if($config['rrdcached']) { $rrd_cmd .= " --daemon ".$config['rrdcached'] . " "; }
+ if($_GET['from']) { $from = mres($_GET['from']); }
+ if($_GET['to']) { $to = mres($_GET['to']); }
+ $rrd_cmd .= " -s " . $from . " -e " . $to;
+}
+
if (isset($_GET['debug'])) {
header('Content-Type: text/plain; charset=utf-8');
printf("Would have executed:\n%s\n", $rrd_cmd);
@@ -217,9 +225,7 @@ if (isset($_GET['debug'])) {
header('Content-Type: image/png');
header('Cache-Control: max-age=60');
$rt = 0;
- if($config['rrdcached']) { $rrd_cmd .= " --daemon ".$config['rrdcached'] . " "; }
passthru($rrd_cmd, $rt);
-# echo("$rrd_cmd");
if ($rt != 0)
return error500($graph_identifier, "RRD failed to generate the graph: ".$rt);
return $rt;
diff --git a/html/includes/collectd/functions.php b/html/includes/collectd/functions.php
index 98ed3b2e66..66f162a0c0 100644
--- a/html/includes/collectd/functions.php
+++ b/html/includes/collectd/functions.php
@@ -550,8 +550,8 @@ function collectd_draw_rrd($host, $plugin, $pinst = null, $type, $tinst = null,
$graph[] = sprintf('GPRINT:%s_avg:LAST:%%5.1lf%%s\\l', $k);
}
- #$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds'], '-t', $rrdfile);
- $rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
+ #$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-t', $rrdfile);
+ $rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height']);
if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', "LEGEND:7:mono", '--font', "AXIS:6:mono", "--font-render-mode", "normal");
$rrd_cmd = array_merge($rrd_cmd, $small_opts);
@@ -579,7 +579,7 @@ function collectd_draw_rrd($host, $plugin, $pinst = null, $type, $tinst = null,
*/
function collectd_draw_generic($timespan, $host, $plugin, $pinst = null, $type, $tinst = null) {
global $config, $GraphDefs;
- $timespan_def = null;
+ $timespan_def = NULL;
foreach ($config['timespan'] as &$ts)
if ($ts['name'] == $timespan)
$timespan_def = $ts;
@@ -590,8 +590,8 @@ function collectd_draw_generic($timespan, $host, $plugin, $pinst = null, $type,
return false;
$rrd_file = sprintf('%s/%s%s%s/%s%s%s', $host, $plugin, is_null($pinst) ? '' : '-', $pinst, $type, is_null($tinst) ? '' : '-', $tinst);
- #$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds'], '-t', $rrd_file);
- $rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
+ #$rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-t', $rrd_file);
+ $rrd_cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height']);
if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', 'LEGEND:7:mono', '--font', 'AXIS:6:mono', '--font-render-mode', 'normal');
@@ -643,10 +643,10 @@ function collectd_draw_meta_stack(&$opts, &$sources) {
if (isset($opts['logarithmic']) && $opts['logarithmic'])
array_unshift($opts['rrd_opts'], '-o');
-# $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds'],
+# $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'],
# '-t', $opts['title']);
- $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
+ $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height']);
if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', 'LEGEND:7:mono', '--font', 'AXIS:6:mono', '--font-render-mode', 'normal');
@@ -741,10 +741,10 @@ function collectd_draw_meta_line(&$opts, &$sources) {
if (isset($opts['logarithmic']) && $opts['logarithmic'])
array_unshift($opts['rrd_opts'], '-o');
-# $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds'], '-t', $opts['title']);
+# $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-t', $opts['title']);
# $cmd = array_merge($cmd, $config['rrd_opts_array'], $opts['rrd_opts']);
- $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height'], '-s', -1*$timespan_def['seconds']);
+ $cmd = array(RRDTOOL, 'graph', '-', '-a', 'PNG', '-w', $config['rrd_width'], '-h', $config['rrd_height']);
if($config['rrd_width'] <= "300") {
$small_opts = array ('--font', 'LEGEND:7:mono', '--font', 'AXIS:6:mono', '--font-render-mode', 'normal');
diff --git a/html/includes/graphs/common.inc.php b/html/includes/graphs/common.inc.php
index e8f765c756..d966cb2f36 100644
--- a/html/includes/graphs/common.inc.php
+++ b/html/includes/graphs/common.inc.php
@@ -12,7 +12,7 @@ if(!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
if(isset($scale_min)) { $rrd_options .= " -l $scale_min"; }
if(isset($scale_max)) { $rrd_options .= " -u $scale_max"; }
-$rrd_options .= " -E --start ".$from." --end " . ($to - 150) . " --width ".$width." --height ".$height." ";
+$rrd_options .= " -E --start ".$from." --end " . $to . " --width ".$width." --height ".$height." ";
$rrd_options .= $config['rrdgraph_def_text'];
if($_GET['bg']) { $rrd_options .= " -c CANVAS#" . mres($_GET['bg']) . " "; }
diff --git a/html/pages/device/collectd.inc.php b/html/pages/device/collectd.inc.php
index 7c45dc6b84..c3ef0b8610 100644
--- a/html/pages/device/collectd.inc.php
+++ b/html/pages/device/collectd.inc.php
@@ -88,24 +88,24 @@ print_optionbar_end();
}
echo("");
- $daily_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=day&to=$now&width=215&height=100";
+ $daily_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$day&to=$now&width=215&height=100";
$daily_traffic .= $args;
- $daily_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=day&to=$now&width=400&height=150";
+ $daily_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$day&to=$now&width=400&height=150";
$daily_url .= $args;
- $weekly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=week&to=$now&width=215&height=100";
+ $weekly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$week&to=$now&width=215&height=100";
$weekly_traffic .= $args;
- $weekly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=week&to=$now&width=400&height=150";
+ $weekly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$week&to=$now&width=400&height=150";
$weekly_url .= $args;
- $monthly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=month&to=$now&width=215&height=100";
+ $monthly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$month&to=$now&width=215&height=100";
$monthly_traffic .= $args;
- $monthly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=month&to=$now&width=400&height=150";
+ $monthly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$month&to=$now&width=400&height=150";
$monthly_url .= $args;
- $yearly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=year&to=$now&width=215&height=100";
+ $yearly_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$year&to=$now&width=215&height=100";
$yearly_traffic .= $args;
- $yearly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=year&to=$now&width=400&height=150";
+ $yearly_url = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=$year&to=$now&width=400&height=150";
$yearly_url .= $args;