fanspeeds and voltages on health tab

git-svn-id: http://www.observium.org/svn/observer/trunk@828 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-02-12 00:01:00 +00:00
parent 4ecc08bec6
commit 41389ab601
3 changed files with 124 additions and 0 deletions

View File

@ -6,6 +6,8 @@ $cemp = mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_
$cmp = mysql_result(mysql_query("select count(*) from cmpMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0);
$cpm = mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0);
$hrprocessor = mysql_result(mysql_query("select count(*) from hrDevice WHERE device_id = '" . $device['device_id'] . "' AND `hrDeviceType` = 'hrDeviceProcessor'"), 0);
$fans = mysql_result(mysql_query("select count(*) from fanspeed WHERE fan_host = '" . $device['device_id'] . "'"), 0);
$volts = mysql_result(mysql_query("select count(*) from voltage WHERE volt_host = '" . $device['device_id'] . "'"), 0);
if ($temp) { $datas[] = 'temp'; }
@ -14,6 +16,8 @@ if ($cemp) { $datas[] = 'cemp'; }
if ($cpm) { $datas[] = 'cpm'; }
if ($cmp) { $datas[] = 'cmp'; }
if ($hrprocessor) { $datas[] = 'hrprocessors'; }
if ($fans) { $datas[] = 'fanspeeds'; }
if ($volts) { $datas[] = 'voltages'; }
$type_text['temp'] = "Temperatures";
$type_text['cmp'] = "Memory Pools";
@ -21,6 +25,8 @@ $type_text['cemp'] = "Memory Enh Pools";
$type_text['cpm'] = "Processor Usage";
$type_text['storage'] = "Disk Usage";
$type_text['hrprocessors'] = "Processor Usage";
$type_text['voltages'] = "Voltages";
$type_text['fanspeeds'] = "Fanspeeds";
print_optionbar_start();

View File

@ -0,0 +1,59 @@
<?php
$sql = "SELECT * FROM `fanspeed` WHERE fan_host = '" . $_GET[id] . "' ORDER BY fan_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['fan_descr'] . "</td>
<td>" . $fan['fan_current'] . " rpm</td>
<td>" . $fan['fan_limit'] . " rpm</td>
<td>" . $fan['fan_notes'] . "</td>
</tr>\n");
echo("<tr bgcolor=$row_colour><td colspan='4'>");
$graph_type = "fanspeed";
// start fanspeed graphs
$daily_fan = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
$weekly_fan = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
$monthly_fan = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
$yearly_fan = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $fan['fan_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_fan' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_fan' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_fan' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_fan' border=0></a>");
echo("</td></tr>");
$row++;
}
echo("</table>");
?>

View File

@ -0,0 +1,59 @@
<?php
$sql = "SELECT * FROM `voltage` WHERE volt_host = '" . $_GET[id] . "' ORDER BY volt_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=350>" . $volt['volt_descr'] . "</td>
<td>" . $volt['volt_current'] . "V</td>
<td>" . $volt['volt_limit_low'] . 'V - ' . $volt['volt_limit'] . "V</td>
<td>" . $volt['volt_notes'] . "</td>
</tr>\n");
echo("<tr bgcolor=$row_colour><td colspan='4'>");
$graph_type = "voltage";
// start voltage graphs
$daily_volt = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
$weekly_volt = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
$monthly_volt = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
$yearly_volt = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $volt['volt_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_volt' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_volt' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_volt' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_volt' border=0></a>");
echo("</td></tr>");
$row++;
}
echo("</table>");
?>