mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
move mount ignores to defaults config file, add option to ignore optical drives, and fix the entire ignore thing as 'someone' broke it after semi-rewriting the storage portion
git-svn-id: http://www.observium.org/svn/observer/trunk@971 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -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";
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user