mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
HOST-RESOURCES-MIB storage-based memory polling (COMMENTS PLEASE)
git-svn-id: http://www.observium.org/svn/observer/trunk@1026 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
foreach($periods as $period) {
|
||||
$graph_array['from'] = $$period;
|
||||
$graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400";
|
||||
echo(overlib_link("#", generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
|
||||
echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -26,7 +26,7 @@ if($ports['total']) {
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$content .= "</div>";
|
||||
|
||||
echo(overlib_link("#", $graph, $content, NULL));
|
||||
echo(overlib_link($_SERVER['REQUEST_URI'], $graph, $content, NULL));
|
||||
|
||||
|
||||
echo(' <div style="height: 5px;"></div>');
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
$storage_array = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
|
||||
|
||||
if(is_array($storage_array)) {
|
||||
echo("hrStorage : ");
|
||||
foreach($storage_array[$device[device_id]] as $index => $storage)
|
||||
{
|
||||
$fstype = $storage['hrStorageType'];
|
||||
$descr = $storage['hrStorageDescr'];
|
||||
$size = $storage['hrStorageSize'] * $storage['hrStorageAllocationUnits'];
|
||||
$used = $storage['hrStorageUsed'] * $storage['hrStorageAllocationUnits'];
|
||||
$units = $storage['hrStorageAllocationUnits'];
|
||||
$deny = 1;
|
||||
|
||||
if ($fstype == "hrStorageVirtualMemory" || $fstype == "hrStorageRam" || $fstype == "hrStorageOther") { $deny = 0; }
|
||||
|
||||
if(!$deny && is_numeric($index)) {
|
||||
discover_mempool($valid_mempool, $device, $index, "hrstorage", $descr, $units, NULL, NULL);
|
||||
}
|
||||
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $storage_array);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
echo("Memory : ");
|
||||
|
||||
include("mempools-hrstorage.inc.php");
|
||||
include("mempools-cemp.inc.php");
|
||||
include("mempools-cmp.inc.php");
|
||||
include("mempools-junos.inc.php");
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/// HOST-RESOURCES-MIB - Memory Objects
|
||||
|
||||
if(!is_array($storage_cache['hrstorage'])) {
|
||||
$storage_cache['hrstorage'] = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
|
||||
if ($debug) { print_r($storage_cache); }
|
||||
} else { if($debug) { echo("Cached!"); } }
|
||||
|
||||
$entry = $storage_cache['hrstorage'][$device[device_id]][$mempool[index]];
|
||||
|
||||
$mempool['units'] = $entry['hrStorageAllocationUnits'];
|
||||
$mempool['used'] = $entry['hrStorageUsed'] * $mempool['units'];
|
||||
$mempool['total'] = $entry['hrStorageSize'] * $mempool['units'];
|
||||
$mempool['free'] = $mempool['total'] - $mempool['used'];
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user