diff --git a/config.php.default b/config.php.default index 57424edf38..490f9b6685 100755 --- a/config.php.default +++ b/config.php.default @@ -124,11 +124,6 @@ $config['allow_entity_sensor']['watts'] = 1; $config['allow_entity_sensor']['truthvalue'] = 1; $config['allow_entity_sensor']['specialEnum'] = 1; -### Mountpoints to ignore - -$config['ignore_mount_removable'] = 1; # Ignore removable disk storage -$config['ignore_mount_network'] = 1; # Ignore network mounted storage - ### Hardcoded ASN descriptions # $config['astext'][65333] = "Cymru Bogon Feed"; diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 09c492def4..049cec01fd 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -71,6 +71,9 @@ $config['bad_if_regexp'] = array("/serial[0-9]:/"); $config['processor_filter'][] = "An electronic chip that makes the computer work."; +$config['ignore_mount_removable'] = 1; # Ignore removable disk storage +$config['ignore_mount_network'] = 1; # Ignore network mounted storage +$config['ignore_mount_optical'] = 1; # Ignore mounted optical discs # Sensors diff --git a/includes/discovery/storage-hrstorage.inc.php b/includes/discovery/storage-hrstorage.inc.php index 9b518d9f26..d0eeb625b3 100755 --- a/includes/discovery/storage-hrstorage.inc.php +++ b/includes/discovery/storage-hrstorage.inc.php @@ -4,28 +4,30 @@ $storage_array = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOUR if(is_array($storage_array)) { echo("hrStorage : "); - foreach($storage_array[$device[device_id]] as $index => $storage) { + foreach($storage_array[$device[device_id]] as $index => $storage) + { foreach($config['ignore_mount'] as $bi) { if($bi == $descr) { $deny = 1; if ($debug) echo("$bi == $descr \n"); } } foreach($config['ignore_mount_string'] as $bi) { if(strpos($descr, $bi) !== FALSE) { $deny = 1; if ($debug) echo("$descr, $bi \n"); } } foreach($config['ignore_mount_regexp'] as $bi) { if(preg_match($bi, $descr)) { $deny = 1; if ($debug) echo("$bi, $descr \n"); } } - if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "hrStorageRemovableDisk") { $deny = 1; if ($debug) echo("skip(removable)\n"); } - if (isset($config['ignore_mount_network']) && $config['ignore_mount_network'] && $fstype == "hrStorageNetworkDisk") { $deny = 1; if ($debug) echo("skip(network)\n"); } - - $type = $storage['hrStorageType']; + $fstype = $storage['hrStorageType']; $descr = $storage['hrStorageDescr']; $size = $storage['hrStorageSize'] * $storage['hrStorageAllocationUnits']; $used = $storage['hrStorageUsed'] * $storage['hrStorageAllocationUnits']; $units = $storage['hrStorageAllocationUnits']; + if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "hrStorageRemovableDisk") { $deny = 1; if ($debug) echo("skip(removable)\n"); } + if (isset($config['ignore_mount_network']) && $config['ignore_mount_network'] && $fstype == "hrStorageNetworkDisk") { $deny = 1; if ($debug) echo("skip(network)\n"); } + if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical'] && $fstype == "hrStorageCompactDisc") { $deny = 1; if ($debug) echo("skip(cd)\n"); } + if(!$deny && is_numeric($index)) { - discover_storage($valid_storage, $device, $index, $type, "hrstorage", $descr, $size , $units, $used); + discover_storage($valid_storage, $device, $index, $fstype, "hrstorage", $descr, $size , $units, $used); } #$old_storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrStorage-" . $index . ".rrd"); #$storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("storage-hrstorage-" . $index . ".rrd"); #if(is_file($old_storage_rrd)) { rename($old_storage_rrd,$storage_rrd); } - unset($deny, $type, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $storage_array); + unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $storage_array); } }