truenas / py-SMART

Wrapper for smartctl (smartmontools)
GNU Lesser General Public License v2.1
79 stars 35 forks source link

On some systems daemons wont look at '/usr/sbin/smartctl' #90

Open dann1kid opened 2 weeks ago

dann1kid commented 2 weeks ago

Describe the bug Using systemd daemon from root does not see the location of smartctl. If you specify SMARTCTL_PATH manually, it works

Raw outputs

ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/.venv/lib/python3.8/site-packages/apscheduler/executors/base.py", line 125, in run_job
ноя 05 14:13:50 localhost.localdomain python[970628]:     retval = job.func(*job.args, **job.kwargs)
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/redadm_client/adapters/inventorisation/inventrorisation.py", line 144, in push_report_broker
ноя 05 14:13:50 localhost.localdomain python[970628]:     data = R8DataCollector().collect_data()
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/redadm_client/adapters/inventorisation/inventrorisation.py", line 129, in collect_data
ноя 05 14:13:50 localhost.localdomain python[970628]:     hdd_data = self.hdd_data_index()
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/redadm_client/adapters/inventorisation/inventrorisation.py", line 52, in hdd_data_index
ноя 05 14:13:50 localhost.localdomain python[970628]:     data = DeviceList()
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/.venv/lib/python3.8/site-packages/pySMART/device_list.py", line 64, in __init__
ноя 05 14:13:50 localhost.localdomain python[970628]:     self.initialize(catch_errors)
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/.venv/lib/python3.8/site-packages/pySMART/device_list.py", line 113, in initialize
ноя 05 14:13:50 localhost.localdomain python[970628]:     for line in self.smartctl.scan():
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/.venv/lib/python3.8/site-packages/pySMART/smartctl.py", line 191, in scan
ноя 05 14:13:50 localhost.localdomain python[970628]:     return self.generic_call(['--scan-open'])[0]
ноя 05 14:13:50 localhost.localdomain python[970628]:   File "/opt/client/.venv/lib/python3.8/site-packages/pySMART/smartctl.py", line 102, in generic_call
ноя 05 14:13:50 localhost.localdomain python[970628]:     raise FileNotFoundError("Command smartctl doesn't exist!")
ноя 05 14:13:50 localhost.localdomain python[970628]: FileNotFoundError: Command smartctl doesn't exist!
ноя 05 14:13:52 localhost.localdomain python[970628]: time     : [2024-11-05 14:13:52]

on call DeviceList()

Environmental setup:

ralequi commented 2 weeks ago

Don't catch the point, I have running pysmart under systemd for years without any special issue.

Could you explain more your issue? Does your program work standalone (without being executed under systemd)? which OS/distribution are you using?