separate and improve overview page

git-svn-id: http://www.observium.org/svn/observer/trunk@515 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-11-11 18:20:32 +00:00
parent 8040941635
commit 08ae40ab1e
17 changed files with 298 additions and 186 deletions

View File

@@ -12,6 +12,7 @@ if($_GET['debug']) {
include("../config.php");
include("../includes/common.php");
include("../includes/graphing.php");
include("../includes/rewrites.php");
include("includes/authenticate.inc");
# if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }

View File

@@ -4,24 +4,20 @@ if($_GET['from']) { $from = mres($_GET['from']); }
if($_GET['to']) { $to = mres($_GET['to']); }
if($_GET['width']) { $width = mres($_GET['width']); }
if($_GET['height']) { $height = mres($_GET['height']); }
if($_GET['bg']) { $bg = mres($_GET['bg']); }
if($_GET['inverse']) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
if($_GET['legend'] == "no") { $rrd_options = " -g"; }
#if($bg) { $rrd_options .= " -c CANVAS#" . $bg . " "; }
if(!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
if(isset($scale_min)) { $rrd_options .= " -l $scale_min"; }
if(isset($scale_max)) { $rrd_options .= " -u $scale_max"; }
$rrd_options .= " -E --start ".$from." --end " . ($to - 150) . " --width ".$width." --height ".$height." ";
$rrd_options .= $config['rrdgraph_def_text'];
$rrd_options .= " -c BACK#FFFFFF";
if($_GET['bg']) { $rrd_options .= " -c CANVAS#" . mres($_GET['bg']) . " "; }
#$rrd_options .= " -c BACK#FFFFFF";
if($height < "99") { $rrd_options .= " --only-graph"; }
if($width <= "300") { $rrd_options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal";

View File

@@ -9,8 +9,8 @@ while($proc = mysql_fetch_array($query)) {
if(is_file($rrd_filename)) {
$descr = str_pad($proc['hrDeviceDescr'], 8);
$descr = substr($descr,0,8);
$descr = short_hrDeviceDescr($proc['hrDeviceDescr']);
$descr = str_replace(":", "\:", $descr);
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;

View File

@@ -2,13 +2,13 @@
include("common.inc.php");
$unit_text = str_pad($unit_text, 10);
$unit_text = substr($unit_text,0,10);
$unit_text = str_pad($unit_text, 13);
$unit_text = substr($unit_text,0,13);
$i = 0;
$iter = 0;
$rrd_options .= " COMMENT:'".$unit_text." Last Min Max Avg\\n'";
$rrd_options .= " COMMENT:'".$unit_text." Cur Min Max Avg\\n'";
foreach($rrd_list as $rrd) {
@@ -20,12 +20,16 @@
$filename = $rrd['filename'];
$descr = $rrd['descr'];
$descr = substr(str_pad(short_hrDeviceDescr($rrd['descr']), 10),0,10);
$id = $rra."_".$i;
$rrd_options .= " DEF:".$id."=$filename:$rra:AVERAGE";
$rrd_options .= " DEF:".$id."min=$filename:$rra:MIN";
$rrd_options .= " DEF:".$id."max=$filename:$rra:MAX";
$rrd_options .= " LINE1.25:".$id."#".$colour.":'$descr'";
$rrd_options .= " GPRINT:".$id.":LAST:%6.2lf GPRINT:".$id.":AVERAGE:%6.2lf";
$rrd_options .= " GPRINT:".$id.":MAX:%6.2lf GPRINT:".$id.":AVERAGE:%6.2lf\\\\n";
$rrd_options .= " GPRINT:".$id.":LAST:%6.2lf GPRINT:".$id."min:MIN:%6.2lf";
$rrd_options .= " GPRINT:".$id."max:MAX:%6.2lf GPRINT:".$id.":AVERAGE:%6.2lf\\\\n";
$i++; $iter++;
}

View File

@@ -13,8 +13,7 @@ include("common.inc.php");
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$proc['descr_fixed'] = str_pad($proc['hrDeviceDescr'], 28);
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
$proc['descr_fixed'] = substr(str_pad(short_hrDeviceDescr($proc['hrDeviceDescr']), 28),0,28);
$proc['descr_fixed'] = str_replace(":", "\:", $proc['descr_fixed']);
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
$rrd_options .= " DEF:proc" . $proc['hrDeviceIndex'] . "=$rrd:usage:AVERAGE ";

View File

@@ -2,7 +2,7 @@
ini_set('allow_url_fopen', 0);
ini_set('display_errors', 0);
#$debug=1;
if($debug) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

View File

@@ -13,8 +13,9 @@
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead width=350><a href='' $proc_popup>" . $proc['hrDeviceDescr'] . "</a></td>
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['hrProcessorLoad'] . "&width=600'></a></td>
echo("<tr><td class=tablehead width=450><a href='' $proc_popup>" . $proc['hrDeviceDescr'] . "</a></td>
<td><a href='#' $proc_popup>
<img src='percentage.php?per=" . $proc['hrProcessorLoad'] . "&width=500'></a></td>
<td style='font-weight: bold; color: $proc_colour'>" . $proc['hrProcessorLoad'] . "%</td>
</tr>");

View File

@@ -31,137 +31,12 @@ echo("
echo("</div>");
#}
if(mysql_result(mysql_query("SELECT count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Processors</p>");
echo("<table width=100%>");
$i = '1';
$procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'");
while($proc = mysql_fetch_array($procs)) {
$proc_url = "?page=device/".$device['device_id']."/health/cpm/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$month&to=$now&width=400&height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='$proc_url' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['cpmCPUTotal5minRev'] . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $proc['cpmCPUTotal5minRev'] . "%</td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
if(mysql_result(mysql_query("SELECT count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Memory Pools</p>");
echo("<table width=100%>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `cempMemPool` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device['device_id']."'
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
$perc = round($mempool['cempMemPoolUsed'] / ($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree']) * 100,2);
$mempool['descr_fixed'] = $entPhysicalName . " ". $mempool['cempMemPoolName'];
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Sub-Module", "Mod", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("DFC Card", "DFC", $mempool['descr_fixed']);
$proc_url = "?page=device/".$device['device_id']."/sensors/mempools/";
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$mempool['descr_fixed'];
$mempool_popup .= "</div><img src=\'graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=125\'>";
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='$proc_url' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>$perc%</td>
<td style='color: $drv_colour'>" . formatstorage($mempool['cempMemPoolFree'], 0) . "/" . formatstorage($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree'], 0) . "</strong></td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Storage</p>");
echo("<table width=100%>");
$i = '1';
echo("<tr class=tablehead><td>Mountpoint</td><td width=203>Usage</td><td width=40></td><td width=75>Total</td>
<td width=75>Used</td></tr>");
$drives = mysql_query("SELECT * FROM `storage` WHERE host_id = '" . $device['device_id'] . "'");
while($drive = mysql_fetch_array($drives)) {
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$drive['perc'] = round($drive['storage_perc'], 0);
$total = formatStorage($total);
$used = formatStorage($used);
$fs_url = "/device/".$device['device_id']."/health/storage/";
$fs_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr'];
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125\'>";
$fs_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc'; }
echo("<tr><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td>
<td><a href='$fs_url' $fs_popup><img src='percentage.php?per=" . $drive['perc'] . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $drive['perc'] . "%</td>
<td>" . $total . "</td>
<td>" . $used . "</td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
unset($temp_seperator);
if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
$total = mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"),0);
$rows = round($total / 2,0);
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Temperatures</p>");
$i = '1';
$temps = mysql_query("SELECT * FROM temperature WHERE temp_host = '" . $device['device_id'] . "'");
echo("<table width=100% valign=top>");
echo("<tr><td width=50%>");
echo("<table width=100% cellspacing=0 cellpadding=2>");
while($temp = mysql_fetch_array($temps)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
$temp_url = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$month&to=$now&width=400&height=125";
$temp_link = "<a href='/device/".$device['device_id']."/health/temp/' onmouseover=\"return ";
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['temp_descr'];
$temp_link .= "</div><img src=\'$temp_url\'>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
$temp_link .= $temp['temp_descr'] . "</a>";
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td><strong>$temp_link</strong></td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "&deg;C</span></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>");
}
include("overview/hrProcessors.inc.php");
include("overview/cpmCPU.inc.php");
include("overview/cemp.inc.php");
include("overview/cmp.inc.php");
include("overview/hrStorage.inc.php");
include("overview/temperatures.inc.php");
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
@@ -181,40 +56,7 @@ echo("</table></div>");
echo("</td><td width=50% valign=top>");
if($interfaces['total']) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
<p class=sectionhead>Total Traffic</p>" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "</div>");
}
if($interfaces['total']) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Interfaces</p><div style='height: 5px;'></div>");
echo("
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
<tr bgcolor=$interfaces_colour align=center><td></td>
<td width=25%><img src='images/16/connect.png' align=absmiddle> $interfaces[total]</td>
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $interfaces[up]</td>
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $interfaces[down]</td>
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $interfaces[disabled]</td></tr>
</table>");
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
$sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
$query = mysql_query($sql);
while($data = mysql_fetch_array($query)) {
$data = ifNameDescr($data);
$data['hostname'] = $device['hostname'];
echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['label']))));
$ifsep = ", ";
}
unset($ifsep);
echo("</div>");
echo("</div>");
}
include("overview/ports.inc.php");
if($services['total']) {

View File

@@ -0,0 +1,41 @@
<?php
if(mysql_result(mysql_query("SELECT count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Memory Pools</p>");
echo("<table width=100%>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `cempMemPool` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device['device_id']."'
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
$perc = round($mempool['cempMemPoolUsed'] / ($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree']) * 100,2);
$mempool['descr_fixed'] = $entPhysicalName . " ". $mempool['cempMemPoolName'];
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Sub-Module", "Mod", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("DFC Card", "DFC", $mempool['descr_fixed']);
$proc_url = "?page=device/".$device['device_id']."/sensors/mempools/";
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$mempool['descr_fixed'];
$mempool_popup .= "</div><img src=\'graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=125\'>";
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='$proc_url' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>$perc%</td>
<td style='color: $drv_colour'>" . formatstorage($mempool['cempMemPoolFree'], 0) . "/" . formatstorage($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree'], 0) . "</strong></td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
$cemp = 1;
}
?>

View File

@@ -0,0 +1,38 @@
<?php
if(mysql_result(mysql_query("SELECT count(*) from cmpMemPool WHERE device_id = '" . $device['device_id'] . "'"),0) && !$cemp) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Memory Pools</p>");
echo("<table width=100%>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `cmpMemPool` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
$perc = round($mempool['cmpUsed'] / ($mempool['cmpUsed'] + $mempool['cmpFree']) * 100,2);
$mempool['descr_fixed'] = $mempool['cmpName'];
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("Sub-Module", "Mod", $mempool['descr_fixed']);
$mempool['descr_fixed'] = str_replace("DFC Card", "DFC", $mempool['descr_fixed']);
$proc_url = "?page=device/".$device['device_id']."/sensors/mempools/";
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$mempool['descr_fixed'];
$mempool_popup .= "</div><img src=\'graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$month&to=$now&width=400&height=125\'>";
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='$proc_url' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>$perc%</td>
<td style='color: $drv_colour'>" . formatstorage($mempool['cmpFree'], 0) . "/" . formatstorage($mempool['cmpUsed'] + $mempool['cmpFree'], 0) . "</strong></td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
?>

View File

@@ -0,0 +1,27 @@
<?php
if(mysql_result(mysql_query("SELECT count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Processors</p>");
echo("<table width=100%>");
$i = '1';
$procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'");
while($proc = mysql_fetch_array($procs)) {
$proc_url = "?page=device/".$device['device_id']."/health/cpm/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$month&to=$now&width=400&height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='$proc_url' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['cpmCPUTotal5minRev'] . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $proc['cpmCPUTotal5minRev'] . "%</td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
?>

View File

@@ -0,0 +1,33 @@
<?php
if(mysql_result(mysql_query("SELECT count(*) from hrDevice WHERE device_id = '" . $device['device_id'] . "' AND hrDeviceType = 'hrDeviceProcessor'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Processors</p>");
echo("<table width=100%>");
$i = '1';
$procs = mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '" . $device['device_id'] . "' AND hrDeviceType = 'hrDeviceProcessor'");
while($proc = mysql_fetch_array($procs)) {
$proc_url = "?page=device/".$device['device_id']."/health/hrprocessors/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$month&to=$now&width=400&height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
$text_descr = short_hrDeviceDescr($proc['hrDeviceDescr']);
if($proc['hrProcessorLoad'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead width=350><a href='' $proc_popup>" . $text_descr . "</a></td>
<td width=220><a href='#' $proc_popup>
<img src='percentage.php?per=" . $proc['hrProcessorLoad'] . "&width=200'></a></td>
<td style='font-weight: bold; color: $proc_colour'>
" . $proc['hrProcessorLoad'] . "%</td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
?>

View File

@@ -0,0 +1,39 @@
<?php
if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Storage</p>");
echo("<table width=100%>");
$i = '1';
echo("<tr class=tablehead><td>Mountpoint</td><td width=203>Usage</td><td width=40></td><td width=75>Total</td>
<td width=75>Used</td></tr>");
$drives = mysql_query("SELECT * FROM `storage` WHERE host_id = '" . $device['device_id'] . "'");
while($drive = mysql_fetch_array($drives)) {
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$drive['perc'] = round($drive['storage_perc'], 0);
$total = formatStorage($total);
$used = formatStorage($used);
$fs_url = "/device/".$device['device_id']."/health/storage/";
$fs_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr'];
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125\'>";
$fs_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc'; }
echo("<tr><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td>
<td><a href='$fs_url' $fs_popup><img src='percentage.php?per=" . $drive['perc'] . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $drive['perc'] . "%</td>
<td>" . $total . "</td>
<td>" . $used . "</td>
</tr>");
$i++;
}
echo("</table>");
echo("</div>");
}
?>

View File

@@ -0,0 +1,36 @@
<?php
if($interfaces['total']) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
<p class=sectionhead>Ports</p>" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "");
echo("<div style='height: 5px;'></div>");
echo("
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
<tr bgcolor=$interfaces_colour align=center><td></td>
<td width=25%><img src='images/16/connect.png' align=absmiddle> $interfaces[total]</td>
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $interfaces[up]</td>
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $interfaces[down]</td>
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $interfaces[disabled]</td></tr>
</table>");
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
$sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
$query = mysql_query($sql);
while($data = mysql_fetch_array($query)) {
$data = ifNameDescr($data);
$data['hostname'] = $device['hostname'];
echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['label']))));
$ifsep = ", ";
}
unset($ifsep);
echo("</div>");
echo("</div>");
}
?>

View File

@@ -0,0 +1,38 @@
<?php
unset($temp_seperator);
if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
$total = mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"),0);
$rows = round($total / 2,0);
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Temperatures</p>");
$i = '1';
$temps = mysql_query("SELECT * FROM temperature WHERE temp_host = '" . $device['device_id'] . "'");
echo("<table width=100% valign=top>");
echo("<tr><td width=50%>");
echo("<table width=100% cellspacing=0 cellpadding=2>");
while($temp = mysql_fetch_array($temps)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
$temp_url = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$month&to=$now&width=400&height=125";
$temp_link = "<a href='/device/".$device['device_id']."/health/temp/' onmouseover=\"return ";
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['temp_descr'];
$temp_link .= "</div><img src=\'$temp_url\'>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
$temp_link .= $temp['temp_descr'] . "</a>";
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td><strong>$temp_link</strong></td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "&deg;C</span></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

@@ -316,7 +316,7 @@ function generatedevicelink($device, $text=0, $start=0, $end=0)
function device_traffic_image($device, $width, $height, $from, $to)
{
return "<img src='graph.php?device=" . $device . "&type=device_bits&from=" . $from . "&to=" . $to . "&width=" . $width . "&height=" . $height . "' />";
return "<img src='graph.php?device=" . $device . "&type=device_bits&from=" . $from . "&to=" . $to . "&width=" . $width . "&height=" . $height . "&legend=no' />";
}
function devclass($device)

View File

@@ -184,6 +184,14 @@ $rewrite_ios_features = array(
'loop' => 'Loop',
);
$rewrite_hrDevice = array (
'GenuineIntel:' => '',
'AuthenticAMD:' => '',
'Intel(R)' => '',
'CPU' => '',
'(R)' => '',
' ' => ' ',
);
// Specific rewrite functions
@@ -220,6 +228,15 @@ function fixifName ($inf)
return $inf;
}
function short_hrDeviceDescr($dev)
{
global $rewrite_hrDevice;
$dev = array_str_replace($rewrite_hrDevice, $dev);
$dev = preg_replace("/\ +/"," ", $dev);
$dev = trim($dev);
return $dev;
}
function short_port_descr ($desc) {
list($desc) = explode("(", $desc);