Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.7 KiB
PHP
Raw Permalink Normal View History

<?php
2020-11-03 21:27:23 +01:00
use Illuminate\Support\Str;
use LibreNMS\Config;
2020-11-23 15:35:35 -06:00
$hrstorage_array = $os->getCacheTable('hrStorageTable', 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
2015-07-13 20:10:26 +02:00
if (is_array($hrstorage_array)) {
echo 'hrStorage : ';
$bad_fs_types = [
'hrStorageVirtualMemory',
'hrStorageRam',
'hrStorageOther',
'nwhrStorageDOSMemory',
'nwhrStorageMemoryAlloc',
'nwhrStorageMemoryPermanent',
'nwhrStorageCacheBuffers',
'nwhrStorageCacheMovable',
'nwhrStorageCacheNonMovable',
'nwhrStorageCodeAndDataMemory',
'nwhrStorageIOEngineMemory',
'nwhrStorageMSEngineMemory',
'nwhrStorageUnclaimedMemory',
];
foreach ($hrstorage_array as $index => $storage) {
if (! is_array($storage)) {
continue;
}
2022-09-05 22:34:59 +02:00
$fstype = $storage['hrStorageType'] ?? null;
$descr = $storage['hrStorageDescr'];
$storage['hrStorageSize'] = fix_integer_value($storage['hrStorageSize']);
$storage['hrStorageUsed'] = fix_integer_value($storage['hrStorageUsed']);
$size = ($storage['hrStorageSize'] * $storage['hrStorageAllocationUnits']);
$used = ($storage['hrStorageUsed'] * $storage['hrStorageAllocationUnits']);
$units = $storage['hrStorageAllocationUnits'];
2015-07-13 20:10:26 +02:00
if (in_array($fstype, $bad_fs_types)) {
continue;
2015-07-13 20:10:26 +02:00
}
2020-11-03 21:27:23 +01:00
if (Str::startsWith($device['os'], 'vmware') && $descr == 'Real Memory') {
$old_rrdfile = ['storage', 'hrstorage', $descr];
$new_rrdfile = ['mempool', 'hrstorage', $storage['hrStorageIndex']];
2021-03-28 17:25:30 -05:00
\Rrd::renameFile($device, $old_rrdfile, $new_rrdfile);
continue;
}
// Skip hrStorage if aixFsTable is available
if ($device['os'] == 'aix' && ! empty($aix_filesystem)) {
continue;
}
if (ignore_storage($device['os'], $descr)) {
continue;
}
2015-07-13 20:10:26 +02:00
if (Config::get('ignore_mount_removable', false) && $fstype == 'hrStorageRemovableDisk') {
d_echo("skip(removable)\n");
continue;
2015-07-13 20:10:26 +02:00
}
if (Config::get('ignore_mount_network', false) && $fstype == 'hrStorageNetworkDisk') {
d_echo("skip(network)\n");
continue;
2015-07-13 20:10:26 +02:00
}
if (Config::get('ignore_mount_optical', false) && $fstype == 'hrStorageCompactDisc') {
d_echo("skip(cd)\n");
continue;
2015-07-13 20:10:26 +02:00
}
if (is_numeric($index)) {
discover_storage($valid_storage, $device, $index, $fstype, 'hrstorage', $descr, $size, $units, $used);
}
2015-07-13 20:10:26 +02:00
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $hrstorage_array);
}//end foreach
2015-07-13 20:10:26 +02:00
}//end if