web: pass resolution parameter to rrd graph

This commit is contained in:
Bart Van Der Meerssche 2010-05-22 16:52:02 +02:00
parent a14c1775b1
commit 411d8eb6c0
1 changed files with 7 additions and 1 deletions

View File

@ -241,24 +241,30 @@ function _logger_dashboard($type, $function, $interval) {
case 'hour': case 'hour':
$data_path = $root_path .'/data/base/'; $data_path = $root_path .'/data/base/';
$start = 'end-1h'; $start = 'end-1h';
$resolution = 60;
break; break;
case 'day': case 'day':
$data_path = $root_path .'/data/base/'; $data_path = $root_path .'/data/base/';
$start = 'end-1d'; $start = 'end-1d';
$resolution = 900;
break; break;
case 'month': case 'month':
$data_path = $root_path .'/data/base/'; $data_path = $root_path .'/data/base/';
$start = 'end-60d'; $start = 'end-60d';
$resolution = 86400;
break; break;
case 'year': case 'year':
$data_path = $root_path .'/data/base/'; $data_path = $root_path .'/data/base/';
$start = 'end-1y'; $start = 'end-1y';
$resolution = 604800;
break; break;
case 'night': case 'night':
$data_path = $root_path .'/data/night/'; $data_path = $root_path .'/data/night/';
$start = 'end-60d'; $start = 'end-60d';
$resolution = 86400;
break; break;
} }
$end = ((int) (time() / $resolution)) * $resolution;
$result_me = db_query("SELECT lm.meter, lm.function, lm.unit, lu.private $result_me = db_query("SELECT lm.meter, lm.function, lm.unit, lu.private
FROM {logger_meters} lm FROM {logger_meters} lm
@ -358,7 +364,7 @@ function _logger_dashboard($type, $function, $interval) {
$TZ = 'TZ="GMT" '; $TZ = 'TZ="GMT" ';
//insert the TZ prior to launching rrdtool to obtain a proper time conversion //insert the TZ prior to launching rrdtool to obtain a proper time conversion
$command = $TZ . $root_path .'/rrdtool graph '. $graph_path . $pngid .'.png -s '. $start . $command = $TZ . $root_path .'/rrdtool graph '. $graph_path . $pngid .'.png -s '. $start .' -e '. $end .' -S '. $resolution .
' --vertical-label '. $unit .' --lower-limit 0 -w 500 -h 350 -E -X 0 --font LEGEND:8:'; ' --vertical-label '. $unit .' --lower-limit 0 -w 500 -h 350 -E -X 0 --font LEGEND:8:';
$command .= $string->def; $command .= $string->def;
$command .= $string->line; $command .= $string->line;