2009-10-27 13:04:16 +00:00
<? php
2011-04-06 13:54:50 +00:00
$sensor = mysql_fetch_assoc ( mysql_query ( "SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '" . mres ( $_GET [ 'a' ]) . "' and D.device_id = E.device_id" ));
2009-10-28 13:49:37 +00:00
2011-03-17 10:57:51 +00:00
switch ( $sensor [ 'entSensorType' ])
{
case 'celsius' :
case 'watts' :
case 'voltsDC' :
case 'amperes' :
$scale_min = "0" ;
break ;
2009-10-28 13:49:37 +00:00
}
2009-10-27 13:04:16 +00:00
2010-07-24 19:14:41 +00:00
include ( "includes/graphs/common.inc.php" );
2009-10-27 13:04:16 +00:00
2010-02-05 22:10:06 +00:00
$rrd_filename = $config [ 'rrd_dir' ] . "/" . $sensor [ 'hostname' ] . "/" . safename ( "ces-" . $sensor [ 'entPhysicalIndex' ] . ".rrd" );
2009-10-27 13:04:16 +00:00
2009-10-28 13:49:37 +00:00
$type = str_pad ( $sensor [ 'entSensorType' ], 8 );
$type = substr ( $type , 0 , 8 );
2009-10-27 13:04:16 +00:00
2009-10-28 13:49:37 +00:00
$rrd_options .= " DEF:avg= $rrd_filename :value:AVERAGE" ;
$rrd_options .= " DEF:min= $rrd_filename :value:MIN" ;
$rrd_options .= " DEF:max= $rrd_filename :value:MAX" ;
$rrd_options .= " COMMENT:' Last Min Max Ave \\ n'" ;
$rrd_options .= " AREA:max#a5a5a5" ;
$rrd_options .= " AREA:min#ffffff" ;
$rrd_options .= " LINE1.25:avg#aa2200:'" . $type . "'" ;
$rrd_options .= " GPRINT:avg:AVERAGE:%5.2lf%s" ;
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s" ;
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s" ;
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s" ;
2009-10-27 13:04:16 +00:00
2011-03-17 10:57:51 +00:00
?>