voltages and fanspeeds on device overview

git-svn-id: http://www.observium.org/svn/observer/trunk@829 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-02-12 16:58:50 +00:00
parent 41389ab601
commit 7317b68951
4 changed files with 95 additions and 2 deletions

View File

@ -37,6 +37,8 @@ include("overview/cemp.inc.php");
include("overview/cmp.inc.php");
include("overview/hrStorage.inc.php");
include("overview/temperatures.inc.php");
include("overview/fanspeeds.inc.php");
include("overview/voltages.inc.php");
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");

View File

@ -0,0 +1,45 @@
<?php
unset($fan_seperator);
if(mysql_result(mysql_query("SELECT count(fan_id) from fanspeed WHERE fan_host = '" . $device['device_id'] . "'"),0)) {
$total = mysql_result(mysql_query("SELECT count(fan_id) from fanspeed WHERE fan_host = '" . $device['device_id'] . "'"),0);
$rows = round($total / 2,0);
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Fanspeeds</p>");
$i = '1';
$fans = mysql_query("SELECT * FROM fanspeed WHERE fan_host = '" . $device['device_id'] . "'");
echo("<table width=100% valign=top>");
echo("<tr><td width=50%>");
echo("<table width=100% cellspacing=0 cellpadding=2>");
while($fan = mysql_fetch_array($fans)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$graph_colour = str_replace("#", "", $row_colour);
$fan_day = "graph.php?id=" . $fan['fan_id'] . "&type=fanspeed&from=$day&to=$now&width=300&height=100";
$fan_week = "graph.php?id=" . $fan['fan_id'] . "&type=fanspeed&from=$week&to=$now&width=300&height=100";
$fan_month = "graph.php?id=" . $fan['fan_id'] . "&type=fanspeed&from=$month&to=$now&width=300&height=100";
$fan_year = "graph.php?id=" . $fan['fan_id'] . "&type=fanspeed&from=$year&to=$now&width=300&height=100";
$fan_minigraph = "<img src='graph.php?id=" . $fan['fan_id'] . "&type=fanspeed&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
$fan_link = "<a href='/device/".$device['device_id']."/health/fan/' onmouseover=\"return ";
$fan_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$fan['fan_descr'];
$fan_link .= "</div><div style=\'width: 750px\'><img src=\'$fan_day\'><img src=\'$fan_week\'><img src=\'$fan_month\'><img src=\'$fan_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
$fan_link_b = $fan_link . $fan_minigraph . "</a>";
$fan_link_c = $fan_link . "<span style='" . ($fan['fan_current'] <= $fan['fan_limit'] ? "color: red" : '') . "'>" . $fan['fan_current'] . "rpm</span></a>";
$fan_link_a = $fan_link . $fan['fan_descr'] . "</a>";
$fan['fan_descr'] = truncate($fan['fan_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$fan_link_a</strong></td><td width=80 align=right class=tablehead>$fan_link_b<td width=80 align=right class=tablehead>$fan_link_c</td></tr>");
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
$i++;
}
echo("</table>");
echo("</td></tr>");
echo("</table>");
echo("</div>");
}
?>

View File

@ -28,11 +28,12 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_h
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['temp_descr'];
$temp_link .= "</div><div style=\'width: 750px\'><img src=\'$temp_day\'><img src=\'$temp_week\'><img src=\'$temp_month\'><img src=\'$temp_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
$temp_link_b = $temp_link . "<span style='color: $temp_colour'>$temp_minigraph " . $temp['temp_current'] . "&deg;C</span></a>";
$temp_link_c = $temp_link . "<span style='color: $temp_colour'>" . $temp['temp_current'] . "&deg;C</span></a>";
$temp_link_b = $temp_link . $temp_minigraph . "</a>";
$temp_link_a = $temp_link . $temp['temp_descr'] . "</a>";
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$temp_link_a</strong></td><td width=140 class=tablehead>$temp_link_b</td></tr>");
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$temp_link_a</strong></td><td width=80 align=right class=tablehead>$temp_link_b<td width=80 align=right class=tablehead>$temp_link_c</td></tr>");
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
$i++;
}

View File

@ -0,0 +1,45 @@
<?php
unset($volt_seperator);
if(mysql_result(mysql_query("SELECT count(volt_id) from voltage WHERE volt_host = '" . $device['device_id'] . "'"),0)) {
$total = mysql_result(mysql_query("SELECT count(volt_id) from voltage WHERE volt_host = '" . $device['device_id'] . "'"),0);
$rows = round($total / 2,0);
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Voltages</p>");
$i = '1';
$volts = mysql_query("SELECT * FROM voltage WHERE volt_host = '" . $device['device_id'] . "'");
echo("<table width=100% valign=top>");
echo("<tr><td width=50%>");
echo("<table width=100% cellspacing=0 cellpadding=2>");
while($volt = mysql_fetch_array($volts)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$graph_colour = str_replace("#", "", $row_colour);
$volt_day = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$day&to=$now&width=300&height=100";
$volt_week = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$week&to=$now&width=300&height=100";
$volt_month = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$month&to=$now&width=300&height=100";
$volt_year = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$year&to=$now&width=300&height=100";
$volt_minigraph = "<img src='graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
$volt_link = "<a href='/device/".$device['device_id']."/health/volt/' onmouseover=\"return ";
$volt_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$volt['volt_descr'];
$volt_link .= "</div><div style=\'width: 750px\'><img src=\'$volt_day\'><img src=\'$volt_week\'><img src=\'$volt_month\'><img src=\'$volt_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
$volt_link_c = $volt_link . "<span " . ($volt['volt_current'] < $volt['volt_limit_low'] || $volt['volt_current'] > $volt['volt_limit'] ? "style='color: red'" : '') . '>' . $volt['volt_current'] . "V</span></a>";
$volt_link_b = $volt_link . $volt_minigraph . "</a>";
$volt_link_a = $volt_link . $volt['volt_descr'] . "</a>";
$volt['volt_descr'] = truncate($volt['volt_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$volt_link_a</strong></td><td width=80 align=right class=tablehead>$volt_link_b<td width=80 align=right class=tablehead>$volt_link_c</td></tr>");
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
$i++;
}
echo("</table>");
echo("</td></tr>");
echo("</table>");
echo("</div>");
}
?>