mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
genericise device health pages
git-svn-id: http://www.observium.org/svn/observer/trunk@1667 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,37 +1,9 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='current' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($current = 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>" . $current['sensor_descr'] . "</td>
|
||||
<td>" . $current['sensor_current'] . "A</td>
|
||||
<td>" . $current['sensor_limit_low'] . 'A - ' . $current['sensor_limit'] . "A</td>
|
||||
<td>" . $current['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||
|
||||
$class = "current";
|
||||
$unit = "A";
|
||||
$graph_type = "sensor_current";
|
||||
|
||||
$graph_array['id'] = $current['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
include("sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
||||
|
@@ -1,41 +1,9 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='fanspeed' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($fan = 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>" . $fan['sensor_descr'] . "</td>
|
||||
<td>" . $fan['sensor_current'] . " rpm</td>
|
||||
<td>" . $fan['sensor_limit'] . " rpm</td>
|
||||
<td>" . $fan['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||
|
||||
$class = "fanspeed";
|
||||
$unit = "RPM";
|
||||
$graph_type = "sensor_fanspeed";
|
||||
|
||||
$graph_array['id'] = $fan['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
include("sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
||||
|
@@ -1,40 +1,9 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE device_id = '" . mres($_GET['id']) . "' AND `sensor_class` = 'freq' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($sensor = 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>" . $sensor['sensor_descr'] . "</td>
|
||||
<td>" . $sensor['sensor_current'] . "Hz</td>
|
||||
<td>" . $sensor['sensor_limit_low'] . 'Hz - ' . $sensor['sensor_limit'] . "Hz</td>
|
||||
<td>" . $sensor['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||
|
||||
$class = "freq";
|
||||
$unit = "Hz";
|
||||
$graph_type = "sensor_frequency";
|
||||
|
||||
$graph_array['id'] = $sensor['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
include("sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
@@ -1,41 +1,9 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='humidity' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($humidity = 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>" . $humidity['sensor_descr'] . "</td>
|
||||
<td>" . $humidity['sensor_current'] . " %</td>
|
||||
<td>" . $humidity['sensor_limit'] . " %</td>
|
||||
<td>" . $humidity['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||
|
||||
$class = "humidity";
|
||||
$unit = "%";
|
||||
$graph_type = "sensor_humidity";
|
||||
|
||||
$graph_array['id'] = $humidity['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
include("sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
||||
|
38
html/pages/device/health/sensors.inc.php
Normal file
38
html/pages/device/health/sensors.inc.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='".$class."' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
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=500>" . $temp['sensor_descr'] . "</td>
|
||||
<td>" . $temp['sensor_type'] . "</td>
|
||||
<td width=50>" . print_temperature($temp['sensor_current'], $temp['sensor_limit']) .$unit. "</td>
|
||||
<td width=50>" . $temp['sensor_limit'] . $unit . "</td>
|
||||
<td width=50>" . $temp['sensor_limit_low'] . $unit ."</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='5'>");
|
||||
|
||||
$graph_array['id'] = $temp['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
|
||||
?>
|
@@ -1,41 +1,9 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='temperature' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
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=400>" . $temp['sensor_descr'] . "</td>
|
||||
<td width=100>" . $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=50>" . $temp['sensor_limit_low'] . "°C</td>
|
||||
<td width=350>" . $temp['sensor_notes'] . "</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='6'>");
|
||||
|
||||
$class = "temperature";
|
||||
$unit = "°C";
|
||||
$graph_type = "sensor_temperature";
|
||||
|
||||
$graph_array['id'] = $temp['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
include("sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
@@ -1,42 +1,9 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='voltage' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
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=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='5'>");
|
||||
|
||||
$class = "voltage";
|
||||
$unit = "V";
|
||||
$graph_type = "sensor_voltage";
|
||||
|
||||
$graph_array['id'] = $volt['sensor_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
include("sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
||||
|
Reference in New Issue
Block a user