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
+22 -17
View File
@@ -1,10 +1,10 @@
<?php
if($_SESSION['userlevel'] >= '5') {
$sql = "SELECT * FROM `storage` AS S, `devices` AS D WHERE S.host_id = D.device_id ORDER BY D.hostname, S.hrStorageDescr";
$sql = "SELECT * FROM `storage` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.storage_descr";
} else {
$sql = "SELECT * FROM `storage` AS S, `devices` AS D, devices_perms as P WHERE D.host_id = D.device_id AND ";
$sql .= "D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.hrStorageDescr";
$sql = "SELECT * FROM `storage` AS S, `devices` AS D, devices_perms as P WHERE D.device_id = D.device_id AND ";
$sql .= "D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.storage_descr";
}
$query = mysql_query($sql);
@@ -12,12 +12,13 @@ $query = mysql_query($sql);
echo("<div style='padding: 5px;'>
<table width=100% cellspacing=0 cellpadding=2>");
echo("<tr class=tablehead>
<th width=280>Device</th>
<th>Storage</th>
<th width=420>Usage</th>
<th width=100>Free</th>
</tr>");
#echo("<tr class=tablehead>
# <th width=280>Device</th>
# <th>Storage</th>
# <th width=100></th>
# <th width=280>Usage</th>
# <th width=100>Used</th>
# </tr>");
$row = 1;
@@ -27,7 +28,7 @@ while($drive = mysql_fetch_array($query)) {
if ($drive["os"] == "junos") {
foreach ($config['ignore_junos_os_drives'] as $jdrive) {
if (preg_match($jdrive, $drive["hrStorageDescr"])) {
if (preg_match($jdrive, $drive["storage_descr"])) {
$skipdrive = 1;
}
}
@@ -36,16 +37,18 @@ while($drive = mysql_fetch_array($query)) {
if ($skipdrive) { continue; }
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 - $used;
$total = $drive['storage_size'];
$used = $drive['storage_used'];
$free = $drive['storage_free'];
$perc = round($drive['storage_perc'], 0);
$total = formatStorage($total);
$used = formatStorage($used);
$store_url = "graph.php?id=" . $drive['storage_id'] . "&type=hrstorage&from=$month&to=$now&width=400&height=125";
$store_url = "graph.php?id=" . $drive['storage_id'] . "&type=storage&from=$month&to=$now&width=400&height=125";
$store_popup = "onmouseover=\"return overlib('<img src=\'$store_url\'>', LEFT);\" onmouseout=\"return nd();\"";
$mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=storage&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';
@@ -53,9 +56,11 @@ while($drive = mysql_fetch_array($query)) {
} else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor='$row_colour'><td>" . generatedevicelink($drive) . "</td><td class=tablehead>" . $drive['hrStorageDescr'] . "</td><td>
<a href='#' $store_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a>
</td><td>" . formatStorage($free) . "</td></tr>");
echo("<tr bgcolor='$row_colour'><td>" . generatedevicelink($drive) . "</td><td class=tablehead>" . $drive['storage_descr'] . "</td>
<td><img src='$mini_graph'></td>
<td>
<a href='#' $store_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, formatStorage($free), "ffffff", $right_background)."</a>
</td><td>$perc"."%</td></tr>");
$row++;