mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
added central function and updated
This commit is contained in:
@@ -1736,3 +1736,21 @@ function get_toner_levels($device, $raw_value, $capacity)
|
||||
|
||||
return round($raw_value / $capacity * 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if we should skip this device from discovery
|
||||
* @param $needles
|
||||
* @param $haystack
|
||||
* @param $name
|
||||
* @return bool
|
||||
*/
|
||||
function can_skip_discovery($needles, $haystack, $name)
|
||||
{
|
||||
foreach ((array)$needles as $needle) {
|
||||
if (preg_match($needle ."i", $haystack)) {
|
||||
d_echo("{$name} - regexp '{$needle}' matches '{$haystack}' - skipping device discovery \n");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user