Skip to content

Commit

Permalink
Fix discovery not including core and submodule handling
Browse files Browse the repository at this point in the history
  • Loading branch information
murrant committed Oct 4, 2023
1 parent d48913d commit a73cbfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion LibreNMS/Poller.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,18 @@ private function saveModulePerformance(string $module, float $start_time, int $s

private function isModuleManuallyEnabled(string $module): ?bool
{
return empty($this->module_override) ? null : in_array($module, $this->module_override);
if (empty($this->module_override)) {
return null;
}

foreach ($this->module_override as $override) {
[$override_module] = explode('/', $override);
if ($module == $override_module) {
return true;
}
}

return false;
}

private function buildDeviceQuery(): Builder
Expand Down
4 changes: 2 additions & 2 deletions includes/discovery/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ function discover_device(&$device, $force_module = false)
return false;
}

$discovery_devices = Config::get('discovery_modules', []);
$discovery_modules = ['core' => true] + Config::get('discovery_modules', []);

/** @var \App\Polling\Measure\MeasurementManager $measurements */
$measurements = app(\App\Polling\Measure\MeasurementManager::class);
$measurements->checkpoint(); // don't count previous stats

foreach ($discovery_devices as $module => $module_status) {
foreach ($discovery_modules as $module => $module_status) {
$os_module_status = Config::getOsSetting($device['os'], "discovery_modules.$module");
d_echo('Modules status: Global' . (isset($module_status) ? ($module_status ? '+ ' : '- ') : ' '));
d_echo('OS' . (isset($os_module_status) ? ($os_module_status ? '+ ' : '- ') : ' '));
Expand Down

0 comments on commit a73cbfb

Please sign in to comment.