librenms/includes/discovery/mempools-hrstorage.inc.php
Adam Amstrong c84a1224ad fix mempool a bit
git-svn-id: http://www.observium.org/svn/observer/trunk@1030 61d68cd4-352d-0410-923a-c4978735b2b8
2010-03-16 17:00:00 +00:00

28 lines
1011 B
PHP
Executable File

<?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") { $deny = 0; }
if(strstr($descr, "MALLOC") || strstr($descr, "UMA")) { $deny = 1; } ## Ignore FreeBSD INSANITY
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);
}
}
?>