mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Improve discovery output. Only output type names if we actually attempt to discover data for that type. (#6551)
This commit is contained in:
committed by
Neil Lathwood
parent
e2f0965b5c
commit
c59ae3c537
@@ -425,14 +425,14 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
|
||||
protected static function discoverType(OS $os, $type)
|
||||
{
|
||||
echo "$type: ";
|
||||
|
||||
$typeInterface = static::getDiscoveryInterface($type);
|
||||
if (!interface_exists($typeInterface)) {
|
||||
echo "ERROR: Discovery Interface doesn't exist! $typeInterface\n";
|
||||
}
|
||||
|
||||
if ($os instanceof $typeInterface) {
|
||||
$have_discovery = $os instanceof $typeInterface;
|
||||
if ($have_discovery) {
|
||||
echo "$type: ";
|
||||
$function = static::getDiscoveryMethod($type);
|
||||
$sensors = $os->$function();
|
||||
if (!is_array($sensors)) {
|
||||
@@ -447,7 +447,9 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
|
||||
self::sync($os->getDeviceId(), $type, $sensors);
|
||||
|
||||
echo PHP_EOL;
|
||||
if ($have_discovery) {
|
||||
echo PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
private static function checkForDuplicateSensors($sensors)
|
||||
|
||||
Reference in New Issue
Block a user