mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
more fixes for new sensor setup. more to come no doubt. also started making graphs which can 'widen'
git-svn-id: http://www.observium.org/svn/observer/trunk@1534 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
include("includes/graphs/common.inc.php");
|
||||
$device = device_by_id_cache($id);
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
if($_GET['width'] > "300") { $descr_len = "40"; } else { $descr_len = "22"; }
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||
while($temperature = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
@@ -37,7 +38,7 @@ while($temperature = mysql_fetch_array($sql))
|
||||
break;
|
||||
}
|
||||
|
||||
$temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], 22),0,22);
|
||||
$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'])) . "'";
|
||||
|
||||
@@ -5,10 +5,12 @@ $device = device_by_id_cache($id);
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
|
||||
if($_GET['width'] > "300") { $descr_len = "38"; } else { $descr_len = "18"; }
|
||||
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
while($voltage = mysql_fetch_array($sql))
|
||||
while($sensor = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
@@ -37,17 +39,18 @@ while($voltage = mysql_fetch_array($sql))
|
||||
break;
|
||||
}
|
||||
|
||||
$hostname = gethostbyid($voltage['device_id']);
|
||||
|
||||
$descr = substr(str_pad($voltage['sensor_descr'], 15),0,15);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
||||
$volt_id = $voltage['sensor_id'];
|
||||
$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_options .= " DEF:volt$volt_id=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " LINE1:volt$volt_id#".$colour.":'" . $descr . "'";
|
||||
$rrd_options .= " GPRINT:volt$volt_id:AVERAGE:%5.2lfV";
|
||||
$rrd_options .= " GPRINT:volt$volt_id:MIN:%5.2lfV";
|
||||
$rrd_options .= " GPRINT:volt$volt_id:MAX:%5.2lfV\\\\l";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
$sensor_id = $sensor['sensor_id'];
|
||||
|
||||
$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";
|
||||
|
||||
$iter++;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ include("includes/graphs/common.inc.php");
|
||||
$device = device_by_id_cache($sensor['device_id']);
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
@@ -29,7 +30,7 @@ include("includes/graphs/common.inc.php");
|
||||
# $rrd_options .= " AREA:tempwarm#FFCCCC";
|
||||
# $rrd_options .= " AREA:tempcold#CCCCFF";
|
||||
# $rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1:temp#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " LINE1:tempwarm#660000";
|
||||
$rrd_options .= " GPRINT:temp:LAST:%4.1lfC";
|
||||
$rrd_options .= " GPRINT:temp:MIN:%4.1lfC";
|
||||
|
||||
@@ -6,26 +6,23 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " -A ";
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$voltage = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND sensor_id = '".mres($_GET['id'])."'"));
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $voltage['device_id'] . "'"),0);
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
$voltage['sensor_descr_fixed'] = substr(str_pad($voltage['sensor_descr'], 22),0,22);
|
||||
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " DEF:volt_max=$rrd_filename:volt:MAX";
|
||||
$rrd_options .= " DEF:volt_min=$rrd_filename:volt:MIN";
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
||||
$rrd_options .= " AREA:volt_max#c5c5c5";
|
||||
$rrd_options .= " AREA:volt_min#ffffffff";
|
||||
|
||||
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " DEF:volt_max=$rrd_filename:volt:MAX";
|
||||
$rrd_options .= " DEF:volt_min=$rrd_filename:volt:MIN";
|
||||
|
||||
$rrd_options .= " AREA:volt_max#c5c5c5";
|
||||
$rrd_options .= " AREA:volt_min#ffffffff";
|
||||
|
||||
#$rrd_options .= " AREA:volt#FFFF99";
|
||||
$rrd_options .= " LINE1.5:volt#cc0000:'" . $voltage['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:volt:LAST:%3.2lfV";
|
||||
$rrd_options .= " GPRINT:volt:MAX:%3.2lfV\\\\l";
|
||||
#$rrd_options .= " AREA:volt#FFFF99";
|
||||
$rrd_options .= " LINE1.5:volt#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:volt:LAST:%3.2lfV";
|
||||
$rrd_options .= " GPRINT:volt:MAX:%3.2lfV\\\\l";
|
||||
|
||||
?>
|
||||
|
||||
@@ -12,13 +12,13 @@ while($temp = mysql_fetch_array($query)) {
|
||||
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
||||
<td width=350>" . $temp['sensor_descr'] . "</td>
|
||||
<td width=350>" . $temp['sensor_type'] . "</td>
|
||||
<td>" . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C</td>
|
||||
<td>" . $temp['sensor_limit'] . " °C</td>
|
||||
<td>" . $temp['sensor_notes'] . "</td>
|
||||
<td width=450>" . $temp['sensor_descr'] . "</td>
|
||||
<td >" . $temp['sensor_type'] . "</td>
|
||||
<td width=50>" . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C</td>
|
||||
<td width=50>" . $temp['sensor_limit'] . " °C</td>
|
||||
<td width=350>" . $temp['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='5'>");
|
||||
|
||||
$graph_type = "sensor_temperature";
|
||||
|
||||
|
||||
@@ -12,12 +12,13 @@ while($volt = mysql_fetch_array($query)) {
|
||||
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
||||
<td width=350>" . $volt['sensor_descr'] . "</td>
|
||||
<td>" . $volt['sensor_current'] . "V</td>
|
||||
<td>" . $volt['sensor_limit_low'] . 'V - ' . $volt['sensor_limit'] . "V</td>
|
||||
<td>" . $volt['sensor_notes'] . "</td>
|
||||
<td width=450>" . $volt['sensor_descr'] . "</td>
|
||||
<td>" . $volt['sensor_type'] . "</td>
|
||||
<td width=50>" . $volt['sensor_current'] . "V</td>
|
||||
<td width=75>" . $volt['sensor_limit_low'] . 'V - ' . $volt['sensor_limit'] . "V</td>
|
||||
<td width=200>" . $volt['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='5'>");
|
||||
|
||||
$graph_type = "sensor_voltage";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user