Commit version 24.12.13800
This commit is contained in:
@ -4,141 +4,135 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// CISCO-FLASH-MIB::ciscoFlashDevicesSupported.0 = Gauge32: 7
|
||||
$ciscoFlashDevicesSupported = snmp_get($device, "ciscoFlashDevicesSupported.0", "-Ovq", 'CISCO-FLASH-MIB'); // Number of Flash devices supported by the system
|
||||
|
||||
if ((int)$ciscoFlashDevicesSupported > 0)
|
||||
{
|
||||
$ciscoFlashDeviceTable = snmpwalk_cache_oid($device, 'ciscoFlashDeviceTable', NULL, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
|
||||
//$ciscoFlashDeviceTable = snmpwalk_cache_oid($device, 'ciscoFlashDeviceName', NULL, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
|
||||
if ((int)$ciscoFlashDevicesSupported > 0) {
|
||||
$ciscoFlashDeviceTable = snmpwalk_cache_oid($device, 'ciscoFlashDeviceTable', NULL, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
|
||||
//$ciscoFlashDeviceTable = snmpwalk_cache_oid($device, 'ciscoFlashDeviceName', NULL, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
|
||||
|
||||
if ($GLOBALS['snmp_status'])
|
||||
{
|
||||
// Disable retries
|
||||
$device_tmp = $device;
|
||||
//$device_tmp['snmp_retries'] = 1;
|
||||
//$device_tmp['snmp_nobulk'] = TRUE;
|
||||
if ($GLOBALS['snmp_status']) {
|
||||
// Disable retries
|
||||
$device_tmp = $device;
|
||||
//$device_tmp['snmp_retries'] = 1;
|
||||
//$device_tmp['snmp_nobulk'] = TRUE;
|
||||
|
||||
$has_hc = FALSE;
|
||||
foreach ($ciscoFlashDeviceTable as $flash)
|
||||
{
|
||||
if (isset($flash['ciscoFlashDeviceSizeExtended']))
|
||||
{
|
||||
$has_hc = TRUE;
|
||||
break;
|
||||
}
|
||||
$has_hc = FALSE;
|
||||
foreach ($ciscoFlashDeviceTable as $flash) {
|
||||
if (isset($flash['ciscoFlashDeviceSizeExtended'])) {
|
||||
$has_hc = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch only required oids, do not use walk!
|
||||
//$oids = array('ciscoFlashDeviceDescr', 'ciscoFlashDeviceRemovable', 'ciscoFlashDevicePartitions', 'ciscoFlashDeviceSizeExtended');
|
||||
//foreach ($oids as $oid)
|
||||
//{
|
||||
// $ciscoFlashDeviceTable = snmpwalk_cache_oid($device_tmp, $oid, $ciscoFlashDeviceTable, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
|
||||
// if ($oid == 'ciscoFlashDeviceSizeExtended')
|
||||
// {
|
||||
// $has_hc = $GLOBALS['snmp_status'];
|
||||
// }
|
||||
//}
|
||||
print_debug_vars($ciscoFlashDeviceTable);
|
||||
|
||||
sleep(5); // Yes, really.. sleep here, because cisco freeze
|
||||
|
||||
//$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, 'ciscoFlashPartitionTable', NULL, 'CISCO-FLASH-MIB');
|
||||
$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, 'ciscoFlashPartitionName', NULL, 'CISCO-FLASH-MIB');
|
||||
/*
|
||||
if ($has_hc)
|
||||
{
|
||||
$oids = array('ciscoFlashPartitionSizeExtended', 'ciscoFlashPartitionFreeSpaceExtended');
|
||||
} else {
|
||||
$oids = array('ciscoFlashPartitionSize', 'ciscoFlashPartitionFreeSpace');
|
||||
}
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
sleep(3); // Yes, really.. sleep here, because cisco freeze
|
||||
$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, $oid, $ciscoFlashPartitionTable, 'CISCO-FLASH-MIB');
|
||||
}
|
||||
*/
|
||||
print_debug_vars($ciscoFlashPartitionTable);
|
||||
|
||||
/* Now this module run as last, sleep and disable mib not required
|
||||
if ($GLOBALS['snmp_error_code'] == 1002)
|
||||
{
|
||||
// We get timeout error here, f* cisco with your shit ;)
|
||||
// Additional sleep here and completely disable this mib now, for do not use it next time...
|
||||
sleep(5);
|
||||
set_entity_attrib('device', $device, 'mib_' . 'CISCO-FLASH-MIB', "0"); /// FIXME. Note for myself, replace later with set_device_mib_disable(), not released yet
|
||||
log_event('Note, polling/discovery by MIB "' . 'CISCO-FLASH-MIB' . '" disabled, due to produced many Timeout errors. You can enable it again in device "Properties -> MIBs" page.', $device, 'device', $device['device_id'], 'warning');
|
||||
}
|
||||
sleep(5); // Yes, really.. sleep here, because cisco freeze and next discovery module return empty
|
||||
*/
|
||||
}
|
||||
|
||||
// Fetch only required oids, do not use walk!
|
||||
//$oids = array('ciscoFlashDeviceDescr', 'ciscoFlashDeviceRemovable', 'ciscoFlashDevicePartitions', 'ciscoFlashDeviceSizeExtended');
|
||||
//foreach ($oids as $oid)
|
||||
//{
|
||||
// $ciscoFlashDeviceTable = snmpwalk_cache_oid($device_tmp, $oid, $ciscoFlashDeviceTable, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
|
||||
// if ($oid == 'ciscoFlashDeviceSizeExtended')
|
||||
// {
|
||||
// $has_hc = $GLOBALS['snmp_status'];
|
||||
// }
|
||||
//}
|
||||
print_debug_vars($ciscoFlashDeviceTable);
|
||||
foreach ($ciscoFlashDeviceTable as $flash_index => $flash) {
|
||||
/*
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceSize.6 = Gauge32: 2048425984 bytes
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceSize.7 = Gauge32: 0 bytes
|
||||
CISCO-FLASH-MIB::ciscoFlashDevicePartitions.6 = Gauge32: 1
|
||||
CISCO-FLASH-MIB::ciscoFlashDevicePartitions.7 = Gauge32: 0
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceName.6 = STRING: disk0
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceName.7 = STRING: disk1
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceDescr.6 = STRING: Disk 0 Flash
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceDescr.7 = STRING: Disk 1 Flash
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceRemovable.6 = INTEGER: true(1)
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceRemovable.7 = INTEGER: true(1)
|
||||
*/
|
||||
$fstype = $flash['ciscoFlashDeviceRemovable'] === 'true' ? 'ciscoFlashRemovable' : 'ciscoFlash';
|
||||
if (isset($flash['ciscoFlashDeviceSizeExtended']) && $flash['ciscoFlashDeviceSizeExtended'] > 0) {
|
||||
$hc = 1;
|
||||
} else {
|
||||
$hc = 0;
|
||||
}
|
||||
|
||||
sleep(5); // Yes, really.. sleep here, because cisco freeze
|
||||
// Do not skip removable for Cisco devices
|
||||
//if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "ciscoFlashRemovable") { print_debug("Skipped removable: $descr"); continue; }
|
||||
if (!$flash['ciscoFlashDeviceSize']) {
|
||||
continue;
|
||||
} // Skip currently not exist flash disks
|
||||
|
||||
//$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, 'ciscoFlashPartitionTable', NULL, 'CISCO-FLASH-MIB');
|
||||
$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, 'ciscoFlashPartitionName', NULL, 'CISCO-FLASH-MIB');
|
||||
/*
|
||||
if ($has_hc)
|
||||
{
|
||||
$oids = array('ciscoFlashPartitionSizeExtended', 'ciscoFlashPartitionFreeSpaceExtended');
|
||||
} else {
|
||||
$oids = array('ciscoFlashPartitionSize', 'ciscoFlashPartitionFreeSpace');
|
||||
foreach ($ciscoFlashPartitionTable[$flash_index] as $partition_index => $partition) {
|
||||
/*
|
||||
CISCO-FLASH-MIB::ciscoFlashPartitionSize.6.1 = Gauge32: 2048425984 bytes
|
||||
CISCO-FLASH-MIB::ciscoFlashPartitionFreeSpace.6.1 = Gauge32: 1380122624 bytes
|
||||
*/
|
||||
$index = "$flash_index.$partition_index";
|
||||
$descr = ($flash['ciscoFlashDeviceDescr'] ? $flash['ciscoFlashDeviceDescr'] : $flash['ciscoFlashDeviceName']);
|
||||
// Clean some descriptions:
|
||||
// ciscoFlashDeviceDescr.2 = Cat4000 Private Flash Area (Not available for general use)
|
||||
[$descr] = explode(' (', $descr);
|
||||
if (($flash['ciscoFlashDevicePartitions'] > 1) || ($partition['ciscoFlashPartitionName'][0] === '/')) {
|
||||
$descr .= ' - ' . $partition['ciscoFlashPartitionName'];
|
||||
}
|
||||
/*
|
||||
if ($hc)
|
||||
{
|
||||
$size = $partition['ciscoFlashPartitionSizeExtended'];
|
||||
$free = $partition['ciscoFlashPartitionFreeSpaceExtended'];
|
||||
} else {
|
||||
$size = $partition['ciscoFlashPartitionSize'];
|
||||
$free = $partition['ciscoFlashPartitionFreeSpace'];
|
||||
}
|
||||
$used = $size - $free;
|
||||
*/
|
||||
|
||||
// FIXME. Skip based on ciscoFlashPartitionStatus: readOnly, runFromFlash, readWrite
|
||||
//if ($partition['ciscoFlashPartitionStatus'] != 'readWrite') { continue; }
|
||||
|
||||
//discover_storage($valid['storage'], $device, $index, $fstype, 'CISCO-FLASH-MIB', $descr, 1, $size, $used, array('storage_hc' => $hc));
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, 'CISCO-FLASH-MIB', $descr, 1, 1, 0, ['storage_hc' => $hc]); // Fake size/used - updated later by poller
|
||||
}
|
||||
}
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
sleep(3); // Yes, really.. sleep here, because cisco freeze
|
||||
$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, $oid, $ciscoFlashPartitionTable, 'CISCO-FLASH-MIB');
|
||||
}
|
||||
*/
|
||||
print_debug_vars($ciscoFlashPartitionTable);
|
||||
|
||||
/* Now this module run as last, sleep and disable mib not required
|
||||
if ($GLOBALS['snmp_error_code'] == 1002)
|
||||
{
|
||||
// We get timeout error here, f* cisco with your shit ;)
|
||||
// Additional sleep here and completely disable this mib now, for do not use it next time...
|
||||
sleep(5);
|
||||
set_entity_attrib('device', $device, 'mib_' . 'CISCO-FLASH-MIB', "0"); /// FIXME. Note for myself, replace later with set_device_mib_disable(), not released yet
|
||||
log_event('Note, polling/discovery by MIB "' . 'CISCO-FLASH-MIB' . '" disabled, due to produced many Timeout errors. You can enable it again in device "Properties -> MIBs" page.', $device, 'device', $device['device_id'], 'warning');
|
||||
}
|
||||
sleep(5); // Yes, really.. sleep here, because cisco freeze and next discovery module return empty
|
||||
*/
|
||||
}
|
||||
|
||||
foreach ($ciscoFlashDeviceTable as $flash_index => $flash)
|
||||
{
|
||||
/*
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceSize.6 = Gauge32: 2048425984 bytes
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceSize.7 = Gauge32: 0 bytes
|
||||
CISCO-FLASH-MIB::ciscoFlashDevicePartitions.6 = Gauge32: 1
|
||||
CISCO-FLASH-MIB::ciscoFlashDevicePartitions.7 = Gauge32: 0
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceName.6 = STRING: disk0
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceName.7 = STRING: disk1
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceDescr.6 = STRING: Disk 0 Flash
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceDescr.7 = STRING: Disk 1 Flash
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceRemovable.6 = INTEGER: true(1)
|
||||
CISCO-FLASH-MIB::ciscoFlashDeviceRemovable.7 = INTEGER: true(1)
|
||||
*/
|
||||
$fstype = $flash['ciscoFlashDeviceRemovable'] === 'true' ? 'ciscoFlashRemovable' : 'ciscoFlash';
|
||||
if (isset($flash['ciscoFlashDeviceSizeExtended']) && $flash['ciscoFlashDeviceSizeExtended'] > 0)
|
||||
{
|
||||
$hc = 1;
|
||||
} else {
|
||||
$hc = 0;
|
||||
}
|
||||
|
||||
// Do not skip removable for Cisco devices
|
||||
//if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "ciscoFlashRemovable") { print_debug("Skipped removable: $descr"); continue; }
|
||||
if (!$flash['ciscoFlashDeviceSize']) { continue; } // Skip currently not exist flash disks
|
||||
|
||||
foreach ($ciscoFlashPartitionTable[$flash_index] as $partition_index => $partition)
|
||||
{
|
||||
/*
|
||||
CISCO-FLASH-MIB::ciscoFlashPartitionSize.6.1 = Gauge32: 2048425984 bytes
|
||||
CISCO-FLASH-MIB::ciscoFlashPartitionFreeSpace.6.1 = Gauge32: 1380122624 bytes
|
||||
*/
|
||||
$index = "$flash_index.$partition_index";
|
||||
$descr = ($flash['ciscoFlashDeviceDescr'] ? $flash['ciscoFlashDeviceDescr'] : $flash['ciscoFlashDeviceName']);
|
||||
// Clean some descriptions:
|
||||
// ciscoFlashDeviceDescr.2 = Cat4000 Private Flash Area (Not available for general use)
|
||||
list($descr) = explode(' (', $descr);
|
||||
if (($flash['ciscoFlashDevicePartitions'] > 1) || ($partition['ciscoFlashPartitionName'][0] === '/'))
|
||||
{
|
||||
$descr .= ' - ' . $partition['ciscoFlashPartitionName'];
|
||||
}
|
||||
/*
|
||||
if ($hc)
|
||||
{
|
||||
$size = $partition['ciscoFlashPartitionSizeExtended'];
|
||||
$free = $partition['ciscoFlashPartitionFreeSpaceExtended'];
|
||||
} else {
|
||||
$size = $partition['ciscoFlashPartitionSize'];
|
||||
$free = $partition['ciscoFlashPartitionFreeSpace'];
|
||||
}
|
||||
$used = $size - $free;
|
||||
*/
|
||||
|
||||
// FIXME. Skip based on ciscoFlashPartitionStatus: readOnly, runFromFlash, readWrite
|
||||
//if ($partition['ciscoFlashPartitionStatus'] != 'readWrite') { continue; }
|
||||
|
||||
//discover_storage($valid['storage'], $device, $index, $fstype, 'CISCO-FLASH-MIB', $descr, 1, $size, $used, array('storage_hc' => $hc));
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, 'CISCO-FLASH-MIB', $descr, 1, 1, 0, array('storage_hc' => $hc)); // Fake size/used - updated later by poller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset ($device_tmp, $flash, $flash_index, $partition, $partition_index, $index, $descr, $size, $used, $free, $hc);
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -16,131 +16,133 @@ $hrStorage = snmp_cache_table($device, "hrStorageEntry", [], "HOST-RESOURCES-MIB
|
||||
|
||||
$dsk_done = [];
|
||||
if (!safe_empty($hrStorage)) {
|
||||
foreach ($hrStorage as $index => $storage) {
|
||||
$hc = 0;
|
||||
$mib = 'HOST-RESOURCES-MIB';
|
||||
$fstype = $storage['hrStorageType'];
|
||||
$descr = $storage['hrStorageDescr'];
|
||||
$units = $storage['hrStorageAllocationUnits'];
|
||||
foreach ($hrStorage as $index => $storage) {
|
||||
$hc = 0;
|
||||
$mib = 'HOST-RESOURCES-MIB';
|
||||
$fstype = $storage['hrStorageType'];
|
||||
$descr = $storage['hrStorageDescr'];
|
||||
$units = $storage['hrStorageAllocationUnits'];
|
||||
|
||||
switch($fstype) {
|
||||
case 'hrStorageVirtualMemory':
|
||||
case 'hrStorageRam':
|
||||
case 'hrStorageOther':
|
||||
case 'hrStorageTypes.20':
|
||||
case 'nwhrStorageDOSMemory':
|
||||
case 'nwhrStorageMemoryAlloc':
|
||||
case 'nwhrStorageMemoryPermanent':
|
||||
case 'nwhrStorageCacheBuffers':
|
||||
case 'nwhrStorageCacheMovable':
|
||||
case 'nwhrStorageCacheNonMovable':
|
||||
case 'nwhrStorageCodeAndDataMemory':
|
||||
case 'nwhrStorageIOEngineMemory':
|
||||
case 'nwhrStorageMSEngineMemory':
|
||||
case 'nwhrStorageUnclaimedMemory':
|
||||
print_debug("skip(memory)");
|
||||
continue 2;
|
||||
switch ($fstype) {
|
||||
case 'hrStorageVirtualMemory':
|
||||
case 'hrStorageRam':
|
||||
case 'hrStorageOther':
|
||||
case 'hrStorageTypes.20':
|
||||
case 'nwhrStorageDOSMemory':
|
||||
case 'nwhrStorageMemoryAlloc':
|
||||
case 'nwhrStorageMemoryPermanent':
|
||||
case 'nwhrStorageCacheBuffers':
|
||||
case 'nwhrStorageCacheMovable':
|
||||
case 'nwhrStorageCacheNonMovable':
|
||||
case 'nwhrStorageCodeAndDataMemory':
|
||||
case 'nwhrStorageIOEngineMemory':
|
||||
case 'nwhrStorageMSEngineMemory':
|
||||
case 'nwhrStorageUnclaimedMemory':
|
||||
print_debug("skip(memory)");
|
||||
continue 2;
|
||||
|
||||
case 'hrStorageRemovableDisk':
|
||||
if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable']) {
|
||||
print_debug("skip(removable)");
|
||||
continue 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'hrStorageNetworkDisk':
|
||||
if (isset($config['ignore_mount_network']) && $config['ignore_mount_network']) {
|
||||
print_debug("skip(network)");
|
||||
continue 2;
|
||||
}
|
||||
break;
|
||||
case 'hrStorageCompactDisc':
|
||||
if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical']) {
|
||||
print_debug("skip(cd)");
|
||||
continue 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'hrStorageRemovableDisk':
|
||||
if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable']) {
|
||||
print_debug("skip(removable)");
|
||||
continue 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'hrStorageNetworkDisk':
|
||||
if (isset($config['ignore_mount_network']) && $config['ignore_mount_network']) {
|
||||
print_debug("skip(network)");
|
||||
continue 2;
|
||||
// Another 'hack' for isilon devices with very big array size
|
||||
if ($descr === '/ifs' && is_device_mib($device, 'ISILON-MIB')) {
|
||||
// Remove from polling by HOST-RESOURCES-MIB
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 'hrStorageCompactDisc':
|
||||
if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical']) {
|
||||
print_debug("skip(cd)");
|
||||
continue 2;
|
||||
|
||||
//32bit counters
|
||||
$size = snmp_dewrap32bit($storage['hrStorageSize']) * $units;
|
||||
$used = snmp_dewrap32bit($storage['hrStorageUsed']) * $units;
|
||||
|
||||
$path = rewrite_storage($descr);
|
||||
|
||||
// Find index from 'UCD-SNMP-MIB::dskTable'
|
||||
foreach ($cache_discovery['ucd-snmp-mib'] as $dsk) {
|
||||
if ($dsk['dskPath'] === $path) {
|
||||
// Using 64bit counters if available
|
||||
if (isset($dsk['dskTotalLow'])) {
|
||||
$dsk['units'] = 1024;
|
||||
$dsk['size'] = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']);
|
||||
$dsk['size'] *= $dsk['units'];
|
||||
if (($dsk['size'] - $size) > $units) {
|
||||
// Use 64bit counters only if dskTotal bigger then hrStorageSize
|
||||
// This is try.. if, if, if and more if
|
||||
$hc = 1;
|
||||
$mib = 'UCD-SNMP-MIB';
|
||||
$index = $dsk['dskIndex'];
|
||||
$fstype = $dsk['dskDevice'];
|
||||
$descr = $dsk['dskPath'];
|
||||
$units = $dsk['units'];
|
||||
$size = $dsk['size'];
|
||||
$used = snmp_size64_high_low($dsk['dskUsedHigh'], $dsk['dskUsedLow']);
|
||||
$used *= $units;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
if (is_numeric($index) && $size != 0) {
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, ['storage_hc' => $hc]);
|
||||
|
||||
// Another 'hack' for isilon devices with very big array size
|
||||
if ($descr === '/ifs' && is_device_mib($device, 'ISILON-MIB')) {
|
||||
// Remove from polling by HOST-RESOURCES-MIB
|
||||
continue;
|
||||
}
|
||||
|
||||
//32bit counters
|
||||
$size = snmp_dewrap32bit($storage['hrStorageSize']) * $units;
|
||||
$used = snmp_dewrap32bit($storage['hrStorageUsed']) * $units;
|
||||
|
||||
$path = rewrite_storage($descr);
|
||||
|
||||
// Find index from 'UCD-SNMP-MIB::dskTable'
|
||||
foreach ($cache_discovery['ucd-snmp-mib'] as $dsk) {
|
||||
if ($dsk['dskPath'] === $path) {
|
||||
// Using 64bit counters if available
|
||||
if (isset($dsk['dskTotalLow'])) {
|
||||
$dsk['units'] = 1024;
|
||||
$dsk['size'] = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']);
|
||||
$dsk['size'] *= $dsk['units'];
|
||||
if (($dsk['size'] - $size) > $units) {
|
||||
// Use 64bit counters only if dskTotal bigger then hrStorageSize
|
||||
// This is try.. if, if, if and more if
|
||||
$hc = 1;
|
||||
$mib = 'UCD-SNMP-MIB';
|
||||
$index = $dsk['dskIndex'];
|
||||
$fstype = $dsk['dskDevice'];
|
||||
$descr = $dsk['dskPath'];
|
||||
$units = $dsk['units'];
|
||||
$size = $dsk['size'];
|
||||
$used = snmp_size64_high_low($dsk['dskUsedHigh'], $dsk['dskUsedLow']);
|
||||
$used *= $units;
|
||||
}
|
||||
$dsk_done[$descr] = $path;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
unset($fstype, $descr, $size, $used, $units, $path, $dsk, $hc);
|
||||
}
|
||||
|
||||
if (is_numeric($index) && $size != 0) {
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, [ 'storage_hc' => $hc ]);
|
||||
|
||||
$dsk_done[$descr] = $path;
|
||||
}
|
||||
|
||||
unset($fstype, $descr, $size, $used, $units, $path, $dsk, $hc);
|
||||
}
|
||||
}
|
||||
|
||||
if (!safe_empty($cache_discovery['ucd-snmp-mib'])) {
|
||||
// Discover 'UCD-SNMP-MIB' if 'HOST-RESOURCES-MIB' empty.
|
||||
$mib = 'UCD-SNMP-MIB';
|
||||
// Discover 'UCD-SNMP-MIB' if 'HOST-RESOURCES-MIB' empty.
|
||||
$mib = 'UCD-SNMP-MIB';
|
||||
|
||||
foreach ($cache_discovery['ucd-snmp-mib'] as $index => $dsk) {
|
||||
// Skip already discovered
|
||||
if (in_array($dsk['dskPath'], $dsk_done, TRUE)) { continue; }
|
||||
foreach ($cache_discovery['ucd-snmp-mib'] as $index => $dsk) {
|
||||
// Skip already discovered
|
||||
if (in_array($dsk['dskPath'], $dsk_done, TRUE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hc = 0;
|
||||
$fstype = $dsk['dskDevice'];
|
||||
$descr = $dsk['dskPath'];
|
||||
$units = 1024;
|
||||
$hc = 0;
|
||||
$fstype = $dsk['dskDevice'];
|
||||
$descr = $dsk['dskPath'];
|
||||
$units = 1024;
|
||||
|
||||
// Using 64bit counters if available
|
||||
if (isset($dsk['dskTotalLow'])) {
|
||||
$hc = 1;
|
||||
$size = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']);
|
||||
$size *= $units;
|
||||
$used = snmp_size64_high_low($dsk['dskUsedHigh'], $dsk['dskUsedLow']);
|
||||
$used *= $units;
|
||||
} else {
|
||||
$size = $dsk['dskTotal'] * $units;
|
||||
$used = $dsk['dskUsed'] * $units;
|
||||
// Using 64bit counters if available
|
||||
if (isset($dsk['dskTotalLow'])) {
|
||||
$hc = 1;
|
||||
$size = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']);
|
||||
$size *= $units;
|
||||
$used = snmp_size64_high_low($dsk['dskUsedHigh'], $dsk['dskUsedLow']);
|
||||
$used *= $units;
|
||||
} else {
|
||||
$size = $dsk['dskTotal'] * $units;
|
||||
$used = $dsk['dskUsed'] * $units;
|
||||
}
|
||||
|
||||
if (is_numeric($index) && $size != 0) {
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, ['storage_hc' => $hc]);
|
||||
}
|
||||
unset($fstype, $descr, $size, $used, $units, $hc);
|
||||
}
|
||||
|
||||
if (is_numeric($index) && $size != 0) {
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, [ 'storage_hc' => $hc ]);
|
||||
}
|
||||
unset($fstype, $descr, $size, $used, $units, $hc);
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user