mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refector: Centralised check for ignore storage devices #5075
This commit is contained in:
committed by
Søren Rosiak
parent
66585b6a88
commit
87de5607df
@@ -917,3 +917,35 @@ function get_toner_capacity($raw_capacity)
|
||||
}
|
||||
return $raw_capacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $descr
|
||||
* @return int
|
||||
*/
|
||||
function ignore_storage($descr)
|
||||
{
|
||||
global $config;
|
||||
$deny = 0;
|
||||
foreach ($config['ignore_mount'] as $bi) {
|
||||
if ($bi == $descr) {
|
||||
$deny = 1;
|
||||
d_echo("$bi == $descr \n");
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($config['ignore_mount_string'] as $bi) {
|
||||
if (strpos($descr, $bi) !== false) {
|
||||
$deny = 1;
|
||||
d_echo("strpos: $descr, $bi \n");
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($config['ignore_mount_regexp'] as $bi) {
|
||||
if (preg_match($bi, $descr) > '0') {
|
||||
$deny = 1;
|
||||
d_echo("preg_match $bi, $descr \n");
|
||||
}
|
||||
}
|
||||
|
||||
return $deny;
|
||||
}
|
||||
|
Reference in New Issue
Block a user