mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Module status cleanups (#15461)
* Module status helper * Correct reference * Rename function to make it more explicit * Same for exists checks, normalize argument names * Use new functions
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
|
||||
namespace LibreNMS\Polling;
|
||||
|
||||
use App\Models\Device;
|
||||
|
||||
class ModuleStatus
|
||||
{
|
||||
public function __construct(
|
||||
@@ -69,6 +71,15 @@ class ModuleStatus
|
||||
return 'globally';
|
||||
}
|
||||
|
||||
public function isEnabledAndDeviceUp(Device $device, bool $check_snmp = true): bool
|
||||
{
|
||||
if ($check_snmp && $device->snmp_disable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->isEnabled() && $device->status;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf('Module %s: Global %s | OS %s | Device %s | Manual %s',
|
||||
|
Reference in New Issue
Block a user