replace old hrStorage poller with generic storage poller and hrStorage plugin

*** OLD RRDFILES ARE USELESS NOW***
remove a load of old processor and storage stuff add more % bars to things


git-svn-id: http://www.observium.org/svn/observer/trunk@936 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-02-24 02:16:56 +00:00
parent bafbe9b5c7
commit afdf4fbfc3
18 changed files with 70 additions and 483 deletions

View File

@@ -1,6 +1,6 @@
<?php
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE device_id = '" . $device['device_id'] . "'"),0)) {
$graph_title = "Storage";
$graph_type = "device_hrstorage";
include ("includes/print-device-graph.php");

View File

@@ -1,30 +1,26 @@
<?php
$temp = mysql_result(mysql_query("select count(*) from temperature WHERE device_id = '" . $device['device_id'] . "'"), 0);
$storage = mysql_result(mysql_query("select count(*) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0);
$cemp = mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0);
$cmp = mysql_result(mysql_query("select count(*) from cmpMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0);
$storage = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0);
$memory = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0);
$processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0);
$fans = mysql_result(mysql_query("select count(*) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
$volts = mysql_result(mysql_query("select count(*) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0);
if ($temp) { $datas[] = 'temp'; }
if ($storage) { $datas[] = 'storage'; }
if ($cemp) { $datas[] = 'cemp'; }
if ($cmp) { $datas[] = 'cmp'; }
if ($memory) { $datas[] = 'memory'; }
if ($processor) { $datas[] = 'processors'; }
if ($fans) { $datas[] = 'fanspeeds'; }
if ($volts) { $datas[] = 'voltages'; }
$type_text['temp'] = "Temperatures";
$type_text['cmp'] = "Memory Pools";
$type_text['cemp'] = "Memory Enh Pools";
$type_text['memory'] = "Memory Pools";
$type_text['storage'] = "Disk Usage";
$type_text['processors'] = "Processor Usage";
$type_text['voltages'] = "Voltages";
$type_text['fanspeeds'] = "Fan Speeds";
print_optionbar_start();
unset ($sep);
@@ -40,7 +36,7 @@ unset ($sep);
print_optionbar_end();
if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) { include("pages/device/health/".mres($_GET['opta']).".inc.php"); }
if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) { include("pages/device/health/".mres($_GET['opta']).".inc.php"); } else { echo("failed to open"); }
?>

View File

@@ -1,62 +0,0 @@
<?php
echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `cempMemPool` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$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']);
$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 bgcolor='$row_colour'><td width=350 class=tablehead><a href='' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "&width=600'></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>");
echo("<tr bgcolor='$row_colour'><td colspan=5>");
$daily_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$day&to=$now&width=400&height=150";
$weekly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$week&to=$now&width=400&height=150";
$monthly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=150";
$yearly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_graph' border=0></a>");
echo("</td></tr>");
$i++;
}
echo("</table>");
echo("</div>");
?>

View File

@@ -1,55 +0,0 @@
<?php
echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `cmpMemPool` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$perc = round($mempool['cmpUsed'] / ($mempool['cmpUsed'] + $mempool['cmpFree']) * 100,2);
$proc_url = "?page=device/".$device['device_id']."/sensors/mempools/";
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$mempool['cmpName'];
$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 bgcolor='$row_colour'><td width=350 class=tablehead><a href='' $mempool_popup>" . $mempool['cmpName'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "&width=600'></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>");
echo("<tr bgcolor='$row_colour'><td colspan=5>");
$daily_graph = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$day&to=$now&width=400&height=150";
$weekly_graph = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$week&to=$now&width=400&height=150";
$monthly_graph = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$month&to=$now&width=400&height=150";
$yearly_graph = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $mempool['cmp_id'] . "&type=cmpMemPool&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_graph' border=0></a>");
echo("</td></tr>");
$i++;
}
echo("</table>");
echo("</div>");
?>

View File

@@ -1,52 +0,0 @@
<?php
echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>");
$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();\"";
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
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>");
echo("<tr bgcolor='$row_colour'><td colspan=5>");
$daily_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$day&to=$now&width=400&height=150";
$weekly_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$week&to=$now&width=400&height=150";
$monthly_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$month&to=$now&width=400&height=150";
$yearly_graph = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $proc['hrDevice_id'] . "&type=hrProcessor&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_graph' border=0></a>");
echo("</td></tr>");
$i++;
}
echo("</table>");
echo("</div>");
?>

View File

@@ -8,16 +8,30 @@
$proc_url = "?page=device/".$device['device_id']."/health/processors/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['processor_descr'];
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['processor_id'] . "&type=processor&from=$month&to=$now&width=400&height=125\'>";
$mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=processor&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$text_descr;
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['proc_id'] . "&type=proc&from=$month&to=$now&width=400&height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($proc['processor_usage'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead width=450><a href='' $proc_popup>" . $proc['processor_descr'] . "</a></td>
<td><a href='#' $proc_popup>
<img src='percentage.php?per=" . $proc['processorLoad'] . "&width=500'></a></td>
<td style='font-weight: bold; color: $proc_colour'>" . $proc['processor_usage'] . "%</td>
$perc = round($proc['processor_usage']);
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73';
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392';
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92';
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
} else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td>
<td width=90><a href='".$proc_url."' $proc_popup><img src='$mini_url'></a></td>
<td width=200><a href='".$proc_url."' $proc_popup>
".print_percentage_bar (400, 20, $perc, $perc."%", "ffffff", $left_background, (100 - $perc)."%" , "ffffff", $right_background)."
</a></td>
</tr>");
echo("<tr bgcolor='$row_colour'><td colspan=5>");

View File

@@ -1,6 +1,6 @@
<?php
$sql = "SELECT * FROM `storage` WHERE host_id = '" . $_GET[id] . "' ORDER BY hrStorageDescr";
$sql = "SELECT * FROM `storage` WHERE device_id = '" . $_GET[id] . "' ORDER BY storage_descr";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=5 width=100%>");
@@ -18,9 +18,9 @@ while($drive = mysql_fetch_array($query)) {
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$free = $total - $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$total = $drive['storage_size'] * $drive['storage_units'];
$used = $drive['storage_used'] * $drive['storage_units'];
$free = $total - $drive['storage_used'] * $drive['storage_units'];
$perc = round($drive['storage_perc'], 0);
$used = formatStorage($used);
$total = formatStorage($total);
@@ -28,8 +28,8 @@ while($drive = mysql_fetch_array($query)) {
$fs_url = "?page=device&id=".$device['device_id']."&section=dev-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=hrstorage&from=$month&to=$now&width=400&height=125\'>";
$fs_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['storage_descr'];
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=storage&from=$month&to=$now&width=400&height=125\'>";
$fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"";
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73';
@@ -38,12 +38,12 @@ while($drive = mysql_fetch_array($query)) {
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
} else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td><td>
echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['storage_descr'] . "</a></td><td>
<a href='$fs_url' $fs_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a>
</td><td>" . $free . "</td><td></td></tr>");
$graph_type = "hrstorage";
$graph_type = "storage";
// start temperature graphs
@@ -61,13 +61,13 @@ while($drive = mysql_fetch_array($query)) {
echo("<tr bgcolor='$row_colour'><td colspan=6>");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$daily_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['storage_descr']."</div><img src=\'$daily_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$daily_temp' border=0></a> ");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$weekly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['storage_descr']."</div><img src=\'$weekly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$weekly_temp' border=0></a> ");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$monthly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['storage_descr']."</div><img src=\'$monthly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$monthly_temp' border=0></a> ");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$yearly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['storage_descr']."</div><img src=\'$yearly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$yearly_temp' border=0></a>");
echo("</td></tr>");

View File

@@ -75,7 +75,8 @@ include("overview/processors.inc.php");
include("overview/mempools.inc.php");
#include("overview/cemp.inc.php");
#include("overview/cmp.inc.php");
include("overview/hrStorage.inc.php");
#include("overview/hrStorage.inc.php");
include("overview/storage.inc.php");
include("overview/temperatures.inc.php");
include("overview/fanspeeds.inc.php");
include("overview/voltages.inc.php");

View File

@@ -1,33 +0,0 @@
<?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

@@ -1,58 +0,0 @@
<?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% cellspacing=0 cellpadding=5>");
$drive_rows = '0';
$drives = mysql_query("SELECT * FROM `storage` WHERE host_id = '" . $device['device_id'] . "'");
while($drive = mysql_fetch_array($drives)) {
$skipdrive = 0;
if ($device["os"] == "junos") {
foreach ($config['ignore_junos_os_drives'] as $jdrive) {
if (preg_match($jdrive, $drive["hrStorageDescr"])) {
$skipdrive = 1;
}
}
}
if ($skipdrive) { continue; }
if(is_integer($drive_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$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=hrstorage&from=$month&to=$now&width=400&height=125\'>";
$fs_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
$mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=hrstorage&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4";
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73';
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392';
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92';
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
} else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td>
<td width=90><a href='".$fs_url."' $fs_popup><img src='$mini_graph' /></a></td>
<td width=200><a href='".$fs_url."' $fs_popup>".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a></td>
</tr>");
$drive_rows++;
}
echo("</table>");
echo("</div>");
}
unset ($drive_rows);
?>

View File

@@ -1,85 +0,0 @@
<?php
$sql = "SELECT * FROM `storage` WHERE host_id = '" . $_GET[id] . "' ORDER BY hrStorageDescr";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=5 width=100%>");
echo("<tr class=tablehead>
<th width=200>Drive</th>
<th width=360>Usage</th>
<th width=50>Used</th>
<th width=50>Total</th>
<th width=50>Free</th>
<th></th>
</tr>");
$row = 1;
while($drive = mysql_fetch_array($query)) {
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$perc = round($drive['storage_perc'], 0);
$total = formatStorage($total);
$used = formatStorage($used);
$fs_url = "?page=device&id=".$device['device_id']."&section=dev-storage";
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73';
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392';
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92';
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
} else { $left_background='9abf5b'; $right_background='bbd392'; }
$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, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"";
$drv_colour = percent_colour($perc);
echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td><td>
<a href='$fs_url' $fs_popup>".print_percentage_bar (200, 16, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a>
</td><td style='font-weight: bold; color: $drv_colour'>" . $perc . "%</td><td>" . $total . "</td><td>" . $used . "</td><td></td></tr>");
$graph_type = "unixfs";
// start temperature graphs
$daily_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=212&height=100";
$daily_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
$weekly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=212&height=100";
$weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
$monthly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=212&height=100";
$monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
$yearly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=212&height=100";
$yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
echo("<tr bgcolor='$row_colour'><td colspan=6>");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$daily_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$daily_temp' border=0></a> ");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$weekly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$weekly_temp' border=0></a> ");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$monthly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$monthly_temp' border=0></a> ");
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$yearly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
<img src='$yearly_temp' border=0></a>");
echo("</td></tr>");
$row++;
}
echo("</table>");
?>