[ZBX-19748] SMART by Zabbix agent 2 LLD failed Created: 2021 Jul 29  Updated: 2024 Apr 10  Resolved: 2022 Oct 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G), Templates (T)
Affects Version/s: 5.4.2, 5.4.3
Fix Version/s: None

Type: Problem report Priority: Minor
Reporter: Alex Assignee: Eriks Sneiders
Resolution: Fixed Votes: 7
Labels: Windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File WD.jpg     PNG File image-2021-10-15-10-10-57-915.png     JPEG File zabbix2.jpg     JPEG File zabbix3.jpg     JPEG File zabbix_agent2.conf-1.jpg     JPEG File Применённый шаблон.jpg    
Team: Team INT

 Description   

Zabbix 5.4.2

Default template "SMART by Zabbix agent 2: SMART: Get attributes" & "SMART by Zabbix agent active 2: SMART: Get attributes"

LLD failed with error(win2019 & win10):
Failed to scan for devices: Cannot unmarshal JSON: invalid character '\u00ad' after top-level value..



 Comments   
Comment by Aleksey Volodin [ 2021 Jul 29 ]

Post on forum related this problem - https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/415662-discussion-thread-for-official-zabbix-smart-disk-monitoring?p=428551#post428551

Comment by Aleksey Volodin [ 2021 Jul 29 ]

Windows Agent 2:

c:\Program Files\Zabbix Agent 2>zabbix_agent2.exe -t smart.disk.discovery
smart.disk.discovery [s|[{"{#NAME}":"sdc","{#DISKTYPE}":"NVME","{#MODEL}":"Samsung SSD 980 250GB","{#SN}":"S64BNJ0R220198Z"},{"{#NAME}":"sda","{#DISKTYPE}":"SSD","{#MODEL}":"WDC WD10JPVX-22JC3T0","{#SN}":"WD-WX71AA314833"},{"{#NAME}":"sdb","{#DISKTYPE}":"SSD","{#MODEL}":"Patriot Burst","{#SN}":"F90B0796110400318558"}]]

Windows smartctl version

c:\Program Files\smartmontools\bin>smartctl.exe -v
smartctl 7.2 2020-12-30 r5155 [x86_64-w64-mingw32-w10-b19043] (sf-7.2-1)

Test from Server:

[root@zabbix54 ~]# zabbix_get -s 192.168.100.15 -k smart.disk.discovery
ZBX_NOTSUPPORTED: Failed to scan for devices: Cannot unmarshal JSON: invalid character '\'' looking for beginning of value..
 
Comment by Mikhail P [ 2021 Sep 05 ]

Аналогичная ситуация. После обнаружения проблемы с версией smartmontools 7.2 пробовал проверить в старой версии 7.1, но безуспешно.

Comment by Ilya S [ 2021 Oct 15 ]

Такая же проблема. Из командной строки вывод такой же:

root@z01:/home/soft# zabbix_get -s 10.0.0.189 -k smart.attribute.discovery
ZBX_NOTSUPPORTED: Failed to scan for devices: Cannot unmarshal JSON: invalid character '\u00ad' after top-level value.. 

Хотя smartctl.exe --scan-open на машине Windows 10 выводит информацию о дисках:

/dev/sda -d ata # /dev/sda, ATA device
/dev/sdb -d ata # /dev/sdb, ATA device

При этом вывод из cmd:

В какую сторону смотреть? Уже перебрал все варианты. Служба запускается от учётной записи системы, путь до smartctl.exe прописан в переменной PATH.

Версия smartmontools 7.2

 

 

Comment by Viktor [ 2021 Dec 10 ]

Zabbix 5.0.18 + zabbix-agent2 5.0.18
Windows-server 2019
smart.disk.get
ZBX_NOTSUPPORTED: Failed to scan for devices: Cannot unmarshal JSON: invalid character '\u00ad' after top-level value..

Comment by Eriks Sneiders [ 2022 Feb 09 ]

When executing smart.disk.* or smart.attribute.* do you configure the `Plugins.Smart.Path=` config field? And if so is it a path to the executable ? Or does it also include the executable file in it.

It must include the executable in it. So that might be the cause of some of the issues.

Comment by Ilya S [ 2022 Feb 15 ]

Спасибо! Получилось! Заработало!

Может кому-то поможет, решение моей проблемы:

  1. Переустановил smartmontools
  2. В zabbix_agent2.conf добавил параметр 
    Plugins.Smart.Path="C:\Program Files\smartmontools\bin\smartctl.exe" 

       3. Перезапустил службу Zabbix Agent 2

       4. Отвязал и привязал заново шаблон SMART by Zabbix agent active 2 (у меня активный агент)

       5. Для теста изменил время обнаружения дисков на 10s в правилах обнаружения и бинго, данные появились!

Я так долго бился с этим, уже не знал что делать, причём я раньше пробовал прописывать путь, но я прописывал путь до папки с файлом, но не к самому файлу. Спасибо огромное за помощь!

UPD: Windows 11, Zabbix Server 5.4.10, Zabbix Agent 2 5.4.8, smartmontools 7.2.1

Comment by Eriks Sneiders [ 2022 Mar 28 ]

Good day Dictonary !

Would it be possible to get some more information?

  • What was the output error?
  • Does smartctl get executed at all, if run separately from the provided pass?
  • What did the Zabbix agent 2 log show (with trace debug level if possible)?
Comment by Eriks Sneiders [ 2022 May 25 ]

Hi, all!

Dictonary  if You or any one else is still having issues with SMART. I'd like to mention a couple of things.

  • As mentioned before the path mast be to the smartctl executable and needs to be in double quotes
  • Zabbix agent 2 needs to be ran with root access rights(sudo)/Admin access.
  • Not all devices support smart. And sometimes they are not in smartctl lists. This might cause an empty response.
  • There has been additional logging added to Zabbix agent 2 smartctl execution and now it logs the command and the raw response. This needs Trace level debug enabled in Zabbix agent 2 configuration file.

So please if the issue still persists, please enable the Trace log option, execute the key again. And if possible please provide the Trace log file.  

Comment by Lazy Zeroed [ 2022 May 30 ]

I've stated zabbix agent with debug level=5 and received following output:

2022/05/30 15:48:57.577912 [Smart] command sudo -n /usr/sbin/smartctl -j -V smartctl raw response:
2022/05/30 15:48:57.577975 failed to execute direct exporter task for key 'smart.attribute.discovery' error: 'Failed to execute smartctl: Command execution failed: exit status 1.'
2022/05/30 15:48:57.578021 failed to obtain PID of dead child process: no child processes
2022/05/30 15:48:57.578050 sending passive check response: ZBX_NOTSUPPORTED: 'Failed to execute smartctl: Command execution failed: exit status 1.' to 'x.x.x.x'

I found that user zabbix have no right to run smartctl

I add to sudoerrs following line:

zabbix ALL=NOPASSWD:    /usr/sbin/smartctl

This modification solved issue.

 

 

Generated at Fri May 02 06:50:41 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.