diff --git a/html/includes/graphs/device/current.inc.php b/html/includes/graphs/device/current.inc.php index aa83a4fce..ba115bb28 100644 --- a/html/includes/graphs/device/current.inc.php +++ b/html/includes/graphs/device/current.inc.php @@ -41,13 +41,12 @@ while($current = mysql_fetch_array($sql)) $descr = substr(str_pad($current['sensor_descr'], 15),0,15); $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $current['sensor_descr'] . ".rrd"); - $current_id = $current['sensor_id']; - $rrd_options .= " DEF:current$current_id=$rrd_filename:current:AVERAGE"; - $rrd_options .= " LINE1:current$current_id#".$colour.":'" . $descr . "'"; - $rrd_options .= " GPRINT:current$current_id:AVERAGE:%5.2lfA"; - $rrd_options .= " GPRINT:current$current_id:MIN:%5.2lfA"; - $rrd_options .= " GPRINT:current$current_id:MAX:%5.2lfA\\\\l"; + $rrd_options .= " DEF:sensor" . $current['sensor_id'] . "=$rrd_filename:sensor:AVERAGE"; + $rrd_options .= " LINE1:sensor" . $current['sensor_id'] . "#".$colour.":'" . $descr . "'"; + $rrd_options .= " GPRINT:sensor" . $current['sensor_id'] . ":AVERAGE:%5.2lfA"; + $rrd_options .= " GPRINT:sensor" . $current['sensor_id'] . ":MIN:%5.2lfA"; + $rrd_options .= " GPRINT:sensor" . $current['sensor_id'] . ":MAX:%5.2lfA\\\\l"; $iter++; } diff --git a/html/includes/graphs/device/fanspeeds.inc.php b/html/includes/graphs/device/fanspeeds.inc.php index da875db88..05758be16 100644 --- a/html/includes/graphs/device/fanspeeds.inc.php +++ b/html/includes/graphs/device/fanspeeds.inc.php @@ -39,14 +39,14 @@ while($fanspeed = mysql_fetch_array($sql)) } $descr = substr(str_pad($fanspeed['sensor_descr'], 17),0,17); - $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("fan-" . $fanspeed['sensor_descr'] . ".rrd"); + $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("fanspeed-" . safename($fanspeed['sensor_type']."-".$fanspeed['sensor_index']) . ".rrd"); $fan_id = $fanspeed['sensor_id']; - $rrd_options .= " DEF:fan$fan_id=$rrd_filename:fan:AVERAGE"; - $rrd_options .= " LINE1:fan$fan_id#".$colour.":'" . $descr . "'"; - $rrd_options .= " GPRINT:fan$fan_id:AVERAGE:%5.0lf\ "; - $rrd_options .= " GPRINT:fan$fan_id:MIN:%5.0lf\ "; - $rrd_options .= " GPRINT:fan$fan_id:MAX:%5.0lf\\\\l"; + $rrd_options .= " DEF:sensor$fan_id=$rrd_filename:sensor:AVERAGE"; + $rrd_options .= " LINE1:sensor$fan_id#".$colour.":'" . $descr . "'"; + $rrd_options .= " GPRINT:sensor$fan_id:AVERAGE:%5.0lf\ "; + $rrd_options .= " GPRINT:sensor$fan_id:MIN:%5.0lf\ "; + $rrd_options .= " GPRINT:sensor$fan_id:MAX:%5.0lf\\\\l"; $iter++; } diff --git a/html/includes/graphs/device/humidity.inc.php b/html/includes/graphs/device/humidity.inc.php index 31e595e6f..1544dd6b0 100644 --- a/html/includes/graphs/device/humidity.inc.php +++ b/html/includes/graphs/device/humidity.inc.php @@ -38,12 +38,12 @@ while($humidity = mysql_fetch_array($sql)) } $humidity['sensor_descr_fixed'] = substr(str_pad($humidity['sensor_descr'], 22),0,22); - $humidityrrd = $config['rrd_dir'] . "/".$device['hostname']."/".safename("humidity-" . $humidity['sensor_descr'] . ".rrd"); - $rrd_options .= " DEF:humidity" . $humidity['sensor_id'] . "=$humidityrrd:humidity:AVERAGE "; - $rrd_options .= " LINE1:humidity" . $humidity['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',quotemeta($humidity['sensor_descr_fixed']))) . "' "; - $rrd_options .= " GPRINT:humidity" . $humidity['sensor_id'] . ":LAST:%3.0lf%% "; - $rrd_options .= " GPRINT:humidity" . $humidity['sensor_id'] . ":MIN:%3.0lf%% "; - $rrd_options .= " GPRINT:humidity" . $humidity['sensor_id'] . ":MAX:%3.0lf%%\\\l "; + $humidityrrd = $config['rrd_dir'] . "/".$device['hostname']."/".safename("humidity-" . safename($humidity['sensor_type']."-".$humidity['sensor_index']) . ".rrd"); + $rrd_options .= " DEF:sensor" . $humidity['sensor_id'] . "=$humidityrrd:sensor:AVERAGE "; + $rrd_options .= " LINE1:sensor" . $humidity['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',quotemeta($humidity['sensor_descr_fixed']))) . "' "; + $rrd_options .= " GPRINT:sensor" . $humidity['sensor_id'] . ":LAST:%3.0lf%% "; + $rrd_options .= " GPRINT:sensor" . $humidity['sensor_id'] . ":MIN:%3.0lf%% "; + $rrd_options .= " GPRINT:sensor" . $humidity['sensor_id'] . ":MAX:%3.0lf%%\\\l "; $iter++; } diff --git a/html/includes/graphs/device/temperatures.inc.php b/html/includes/graphs/device/temperatures.inc.php index 1ba473d93..eae9759ea 100644 --- a/html/includes/graphs/device/temperatures.inc.php +++ b/html/includes/graphs/device/temperatures.inc.php @@ -39,12 +39,12 @@ while($temperature = mysql_fetch_array($sql)) } $temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], $descr_len),0,$descr_len); - $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd"; - $rrd_options .= " DEF:temp" . $temperature['sensor_id'] . "=$rrd_file:temp:AVERAGE "; - $rrd_options .= " LINE1:temp" . $temperature['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',$temperature['sensor_descr_fixed'])) . "'"; - $rrd_options .= " GPRINT:temp" . $temperature['sensor_id'] . ":LAST:%4.1lfC "; - $rrd_options .= " GPRINT:temp" . $temperature['sensor_id'] . ":MIN:%4.1lfC "; - $rrd_options .= " GPRINT:temp" . $temperature['sensor_id'] . ":MAX:%4.1lfC\\\l "; + $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd"; + $rrd_options .= " DEF:sensor" . $temperature['sensor_id'] . "=$rrd_file:sensor:AVERAGE "; + $rrd_options .= " LINE1:sensor" . $temperature['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',$temperature['sensor_descr_fixed'])) . "'"; + $rrd_options .= " GPRINT:sensor" . $temperature['sensor_id'] . ":LAST:%4.1lfC "; + $rrd_options .= " GPRINT:sensor" . $temperature['sensor_id'] . ":MIN:%4.1lfC "; + $rrd_options .= " GPRINT:sensor" . $temperature['sensor_id'] . ":MAX:%4.1lfC\\\l "; $iter++; } diff --git a/html/includes/graphs/device/voltages.inc.php b/html/includes/graphs/device/voltages.inc.php index 6e2df235a..d2d7a9c1b 100644 --- a/html/includes/graphs/device/voltages.inc.php +++ b/html/includes/graphs/device/voltages.inc.php @@ -43,14 +43,13 @@ while($sensor = mysql_fetch_array($sql)) $sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len); $sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed'])); - $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd"; - $sensor_id = $sensor['sensor_id']; + $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/voltage-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd"; - $rrd_options .= " DEF:s$sensor_id=$rrd_filename:volt:AVERAGE"; - $rrd_options .= " LINE1:s$sensor_id#".$colour.":'" . $sensor['sensor_descr_fixed'] . "'"; - $rrd_options .= " GPRINT:s$sensor_id:AVERAGE:%5.2lfV"; - $rrd_options .= " GPRINT:s$sensor_id:MIN:%5.2lfV"; - $rrd_options .= " GPRINT:s$sensor_id:MAX:%5.2lfV\\\\l"; + $rrd_options .= " DEF:sensor" . $sensor['sensor_id'] . "=$rrd_filename:sensor:AVERAGE"; + $rrd_options .= " LINE1:sensor" . $sensor['sensor_id'] . "#".$colour.":'" . $sensor['sensor_descr_fixed'] . "'"; + $rrd_options .= " GPRINT:sensor" . $sensor['sensor_id'] . ":AVERAGE:%5.2lfV"; + $rrd_options .= " GPRINT:sensor" . $sensor['sensor_id'] . ":MIN:%5.2lfV"; + $rrd_options .= " GPRINT:sensor" . $sensor['sensor_id'] . ":MAX:%5.2lfV\\\\l"; $iter++; } diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index fc30d4599..b66299b16 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -28,7 +28,8 @@ if(is_numeric($_GET['optd'])) { $to = $_GET['optd']; } else { $to = $now; } include("includes/error-no-perm.inc.php"); } else { - if(isset($config['graph'][$type][$subtype])) { $title .= " :: ".$config['graph'][$type][$subtype]; } else { $title .= " :: ".$graph_type; } +# Do we really need to show the type? User does not have to see the type of graph (i.e. sensor_temperature) +# if(isset($config['graph'][$type][$subtype])) { $title .= " :: ".$config['graph'][$type][$subtype]; } else { $title .= " :: ".$graph_type; } $graph_array['height'] = "60"; $graph_array['width'] = "150"; @@ -96,7 +97,6 @@ if(is_numeric($_GET['optd'])) { $to = $_GET['optd']; } else { $to = $now; } echo(" "); - $graph_array['from'] = $year; echo("
Year