Skip to content

Conversation

crazy-max
Copy link
Member

This PR includes two changes:


First one to check if disk is a valid device. In one case I have, smartctl -i /dev/zd336 fails and returns:

smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.8.12-13-pve] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/zd96: Unable to detect device type
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

We should check if smartctl succeeds.


And last one strips spaces for model name returned otherwise the poller fails to parse hddtemp from unix_agent module:

#### Load poller module unix-agent ####
  
LibreNMS UNIX Agent: execution time: 705ms
hddtemp: 
Processes: 
Sensors: -/dev/nvme0n1: SamsungSSD970PRO512GB: Cur 34, Low: 24, Low Warn: , Warn: , High: 54  
+25 °C  
25 °C  
25 °C  
25 °C  
Exception: ValueError "0" is not a valid backing value for enum LibreNMS\Enum\Sensor @ /opt/librenms/includes/polling/functions.inc.php:140
#0 /opt/librenms/includes/polling/functions.inc.php(140): LibreNMS\Enum\Sensor::from()
#1 /opt/librenms/includes/polling/unix-agent.inc.php(215): record_sensor_data()
#2 /opt/librenms/LibreNMS/Modules/LegacyModule.php(112): include('...')
#3 /opt/librenms/app/Jobs/PollDevice.php(139): LibreNMS\Modules\LegacyModule->poll()
#4 /opt/librenms/app/Jobs/PollDevice.php(63): App\Jobs\PollDevice->pollModules()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\PollDevice->handle()
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(96): Illuminate\Container\Util::unwrapIfClosure()
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(754): Illuminate\Container\BoundMethod::call()
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Container\Container->call()
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(169): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(126): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(136): Illuminate\Pipeline\Pipeline->then()
#14 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(125): Illuminate\Bus\Dispatcher->dispatchNow()
#15 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(169): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#16 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(126): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#17 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Pipeline\Pipeline->then()
#18 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(68): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#19 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\Queue\CallQueuedHandler->call()
#20 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(130): Illuminate\Queue\Jobs\Job->fire()
#21 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(110): Illuminate\Queue\SyncQueue->executeJob()
#22 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(250): Illuminate\Queue\SyncQueue->push()
#23 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(234): Illuminate\Bus\Dispatcher->pushCommandToQueue()
#24 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(101): Illuminate\Bus\Dispatcher->dispatchToQueue()
#25 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(76): Illuminate\Bus\Dispatcher->dispatchSync()
#26 /opt/librenms/app/Console/Commands/DevicePoll.php(79): App\Jobs\PollDevice::dispatchSync()
#27 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\DevicePoll->handle()
#28 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#29 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(96): Illuminate\Container\Util::unwrapIfClosure()
#30 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#31 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(754): Illuminate\Container\BoundMethod::call()
#32 /opt/librenms/vendor/laravel/framework/src/Illuminate/Console/Command.php(209): Illuminate\Container\Container->call()
#33 /opt/librenms/vendor/symfony/console/Command/Command.php(318): Illuminate\Console\Command->execute()
#34 /opt/librenms/vendor/laravel/framework/src/Illuminate/Console/Command.php(178): Symfony\Component\Console\Command\Command->run()
#35 /opt/librenms/vendor/symfony/console/Application.php(1092): Illuminate\Console\Command->run()
#36 /opt/librenms/vendor/symfony/console/Application.php(341): Symfony\Component\Console\Application->doRunCommand()
#37 /opt/librenms/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRun()
#38 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\Component\Console\Application->run()
#39 /opt/librenms/lnms(37): Illuminate\Foundation\Console\Kernel->handle()
#40 {main}

For example it currently returns:

|/dev/sda|Samsung SSD 870 QVO 4TB|25|C|

But should be:

|/dev/sda|SamsungSSD870QVO4TB|25|C|

cc @jasoncheng7115

@crazy-max crazy-max requested a review from murrant August 21, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant