mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
much much much much much much prettier percentage bars and some moving around of overview page.
git-svn-id: http://www.observium.org/svn/observer/trunk@832 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
function print_percentage_bar ($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background) {
|
||||
$output = "<div style='font-size:11px;'><div style=' width:".$width."px; height:".$height."px; background-color:#".$right_background.";'>
|
||||
<div style='width:".$percent."%; height:".$height."px; background-color:#".$left_background."; border-right:0px white solid;'></div>
|
||||
<div style='margin-top:-".($height + 2)."px; color:#".$left_colour."; padding-left:4px;'><b>".$left_text."</b></div>
|
||||
<div style='text-align:right; margin-top:-".($height + 2)."px; color:#".$right_colour."; padding-right:4px;'><b>".$right_text."</b></div></div>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function generate_if_link($args)
|
||||
{
|
||||
global $twoday; global $now; global $config; global $day; global $month;
|
||||
|
@@ -4,7 +4,6 @@ $temp = mysql_result(mysql_query("select count(*) from temperature WHERE device_
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
@@ -13,7 +12,6 @@ $volts = mysql_result(mysql_query("select count(*) from voltage WHERE device_id
|
||||
if ($temp) { $datas[] = 'temp'; }
|
||||
if ($storage) { $datas[] = 'storage'; }
|
||||
if ($cemp) { $datas[] = 'cemp'; }
|
||||
if ($cpm) { $datas[] = 'cpm'; }
|
||||
if ($cmp) { $datas[] = 'cmp'; }
|
||||
if ($hrprocessor) { $datas[] = 'hrprocessors'; }
|
||||
if ($processor) { $datas[] = 'processors'; }
|
||||
@@ -23,7 +21,6 @@ if ($volts) { $datas[] = 'voltages'; }
|
||||
$type_text['temp'] = "Temperatures";
|
||||
$type_text['cmp'] = "Memory Pools";
|
||||
$type_text['cemp'] = "Memory Enh Pools";
|
||||
$type_text['cpm'] = "Processor Usage";
|
||||
$type_text['storage'] = "Disk Usage";
|
||||
$type_text['hrprocessors'] = "Processor Usage";
|
||||
$type_text['processors'] = "Processor Usage";
|
||||
|
@@ -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 `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 width=350><a href='' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
|
||||
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['cpmCPUTotal5minRev'] . "&width=600'></a></td>
|
||||
<td style='font-weight: bold; color: $drv_colour'>" . $proc['cpmCPUTotal5minRev'] . "%</td>
|
||||
</tr>");
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=5>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&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>");
|
||||
|
||||
|
||||
?>
|
@@ -46,8 +46,6 @@ echo("
|
||||
<td width=25% class=grey><img src='images/16/cog_disable.png' align=absmiddle> $services[disabled]</td></tr>
|
||||
</table>");
|
||||
|
||||
|
||||
|
||||
echo("<div style='padding: 8px; font-size: 11px; font-weight: bold;'>");
|
||||
|
||||
$sql = "SELECT * FROM services WHERE service_host = '" . $device['device_id'] . "' ORDER BY service_type";
|
||||
@@ -63,6 +61,8 @@ echo("
|
||||
|
||||
echo("</div>");
|
||||
|
||||
echo("</div>");
|
||||
|
||||
}
|
||||
|
||||
echo("</div>");
|
||||
@@ -72,7 +72,6 @@ echo("<div style='float:right; width: 50%;'>");
|
||||
|
||||
### Right Pane
|
||||
include("overview/processors.inc.php");
|
||||
include("overview/hrProcessors.inc.php");
|
||||
include("overview/cemp.inc.php");
|
||||
include("overview/cmp.inc.php");
|
||||
include("overview/hrStorage.inc.php");
|
||||
|
@@ -3,16 +3,15 @@
|
||||
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("<table width=100% cellspacing=0 cellpadding=5>");
|
||||
$drive_rows = '0';
|
||||
|
||||
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)) {
|
||||
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'];
|
||||
$drive['perc'] = round($drive['storage_perc'], 0);
|
||||
$perc = round($drive['storage_perc'], 0);
|
||||
$total = formatStorage($total);
|
||||
$used = formatStorage($used);
|
||||
|
||||
@@ -22,18 +21,26 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id
|
||||
$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();\"";
|
||||
|
||||
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>
|
||||
$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, 16, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a></td>
|
||||
</tr>");
|
||||
$i++;
|
||||
$drive_rows++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
unset ($drive_rows);
|
||||
|
||||
?>
|
||||
|
@@ -19,15 +19,22 @@ if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '
|
||||
$mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=processor&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4";
|
||||
|
||||
$text_descr = $proc['processor_descr'];
|
||||
# $text_descr = short_processor_descr($proc['processor_descr']);
|
||||
$text_descr = short_hrDeviceDescr($proc['processor_descr']);
|
||||
|
||||
if($proc['processor_usage'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
|
||||
echo("<tr bgcolor=$row_colour><td class=tablehead width=350><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td>
|
||||
<td width=100><a href='".$proc_url."'><img src='$mini_url'></a></td>
|
||||
<td width=160><a href='".$proc_url."' $proc_popup>
|
||||
<img src='percentage.php?per=" . $proc['processor_usage'] . "&width=150'></a></td>
|
||||
<td style='font-weight: bold; color: $proc_colour'>
|
||||
" . $proc['processor_usage'] . "%</td>
|
||||
$perc = $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 (200, 16, $perc, NULL, "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."
|
||||
</a></td>
|
||||
</tr>");
|
||||
$processor_rows++;
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ echo("Processors : ");
|
||||
|
||||
include("processors-ios.inc.php");
|
||||
include("processors-junose.inc.php");
|
||||
include("processors-hrdevice.inc.php");
|
||||
|
||||
### Remove processors which weren't redetected here
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
if (isset($config['ignore_mount_network']) && $config['ignore_mount_network'] && $fstype == "hrStorageNetworkDisk") { $allow = 0; if ($debug) echo("network, skipping\n"); }
|
||||
$descr = str_replace("mounted on: ", "", $descr);
|
||||
$descr = preg_replace("/: [A-Za-z0-9_]+ file system, /", ", ", $descr);
|
||||
echo("$fstype");
|
||||
|
||||
if($size > '0' && $allow) {
|
||||
if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"),0) == '0') {
|
||||
@@ -32,10 +33,12 @@
|
||||
echo("+");
|
||||
} else {
|
||||
$data = mysql_fetch_array(mysql_query("SELECT * FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"));
|
||||
if($data['hrStorageDescr'] != $descr || $data['hrStorageSize'] != $size || $data['hrStorageAllocationUnits'] != $units ) {
|
||||
if($data['hrStorageDescr'] != $descr || $data['hrStorageSize'] != $size || $data['hrStorageAllocationUnits'] != $units || $data['hrStorageType'] != $fstype) {
|
||||
$query = "UPDATE storage SET `hrStorageDescr` = '$descr', `hrStorageType` = '$fstype', `hrStorageSize` = '$size', `hrStorageAllocationUnits` = '$units' ";
|
||||
$query .= ", `hrStorageType` = '$fstype' ";
|
||||
$query .= "WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'";
|
||||
echo("U");
|
||||
if($debug) { echo("$query \n"); }
|
||||
mysql_query($query);
|
||||
} else { echo("."); }
|
||||
}
|
||||
|
@@ -34,6 +34,6 @@ if (!is_file($hrSystem_rrd)) {
|
||||
rrdtool_update($hrSystem_rrd, "N:$hrSystemNumUsers:$hrSystemProcesses:$uptime");
|
||||
|
||||
include("hr-mib_storage.inc.php"); // Run HOST-RESOURCES-MIB Storage
|
||||
include("hr-mib_processor.inc.php"); // Run HOST-RESOURCES-MIB ProcessorLoad
|
||||
#include("hr-mib_processor.inc.php"); // Run HOST-RESOURCES-MIB ProcessorLoad
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user