[ZBX-20339] Zabbix Agent 2 - SMART plugin - Incorrect type of disk in LLD for unknown HDD Created: 2021 Dec 10  Updated: 2024 Apr 10  Resolved: 2022 Mar 30

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: 5.0.18
Fix Version/s: 5.0.21rc1, 5.4.11rc1, 6.0.1rc1, 6.2.0alpha1, 6.2 (plan)

Type: Problem report Priority: Major
Reporter: Maksim Strekalovskikh Assignee: Eriks Sneiders
Resolution: Fixed Votes: 0
Labels: Agent2, SMART, plugins
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Production:

  • Zabbix Server 5.0.18
  • Debian 10.11
  • PostgreSQL 12.9 (Debian 12.9-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
  • TimescaleDB 1.7.4

Zabbix Agent:

  • Debian 11.1
  • Zabbix Agent 2 - 5.0.18
  • smartmontools 7.2

Attachments: PNG File smart-zbx.png     File smart.disk.discovery - ok.json     File smart.disk.discovery - problem.json     File smart.disk.get - problem.json     File smartctl - problem.json    
Team: Team INT
Sprint: Sprint 84 (Jan 2022), Sprint 85 (Feb 2022), Sprint 86 (Mar 2022)
Story Points: 0.5

 Description   

Hi.

Have a problem with plugin SMART for Zabbix Agent 2.

Zabbix in LLD key - "smart.disk.discovery", in LLD macro {#DISKTYPE} - instead of HDD, outputs SSD. In this case by default, the disc type is inserted into the application what will be misleading.

Steps to reproduce:

  1. Install Zabbix Agent 2 via apt from official repo.
  2. Install smartmontools, sudo via apt from Debian packages.
  3. nano /etc/sudoers
  4. Insert access - "zabbix  ALL=(root) NOPASSWD: /usr/sbin/smartctl"
  5. nano /etc/zabbix/zabbix_agent2.conf
  6. Insert path to smartmontools - "Plugins.Smart.Path=/usr/sbin/smartctl"
  7. service zabbix-agent2 restart
  8. In frontend, import official template (https://www.zabbix.com/ru/integrations/smart)
  9. Connect template to host.
  10. Wait LLD or Check now LLD or Test LLD

Result:

Wrong disk type (in attachments - smart.disk.discovery - problem.json)

Expected:

This disk should have been output as an HDD disk.

This problem manifests itself in both Linux and Windows systems.

 

{{/usr/sbin/update-smart-drivedb - }}this command did not help.

If you make a data request via Zabbix for JSON data, you can see that the disk is detected, but the "disk_type" is "unknown" (in attachments - smart.disk.get - problem.json). And there is no "rotation_rate" parameter in JSON. In the plugin code, it is this parameter that determines whether it is an HDD or SSD, and if this is an unknown type of disk, then SSD will always be detected, which I think is incorrect (in attachments - smart-zbx.png, https://github.com/zabbix/zabbix/blob/65f08dbeaf9b49c41026ec2e6aa3f2fe44a45685/src/go/plugins/smart/smart.go#L205)

Checked on other machines where SSD is installed, there will always parameter "disk_type" will be SSD (in attachments - smart.disk.get - ok.json).

 

If it really is a problem, then I will gladly wait for a solution to the problem. If additional information is needed, I am ready to try to provide.
Thank you!



 Comments   
Comment by Edgar Akhmetshin [ 2021 Dec 13 ]

Hello Maksim,

Thank you for reporting the issue. Looks like detection of the ssd/hdd is incorrect, should be fixed. Confirmed.

Regards,
Edgar

Comment by Maksim Strekalovskikh [ 2021 Dec 13 ]

Hi, @edgar.akhmetshin

Thank you for reviewing the ticket and confirming it.

We will wait for the fix in the nearest version.

Comment by Eriks Sneiders [ 2022 Jan 17 ]

Hi, MaxSH97 I've implemented a fix, on a branch for this issue, although since we parse and return disk type based on smartmontools, if smartmontools returns unknown, it will be forwarded as unknown.

I wanted to ask maybe you can run smartmontools on your machine and provide the raw json?

If you wish you could use the branch to test your device and see if it resolved the issue, and you do not see a false disk type.

Regards,
Eriks

Comment by Maksim Strekalovskikh [ 2022 Jan 18 ]

Hi, @esneiders!

Thank you for being taken to work this problem.

About raw json from smartmontools. No problem, attached to the ticket - smartctl - problem.json

I also managed to test the agent from your branch. Unfortunately on the problem disk, the type of disk continues to appear in LLD - SSD.

If additional tests are needed or any additional information is needed, I will try to provide it.

Regards,
Maksim Strekalovskikh

Comment by Eriks Sneiders [ 2022 Jan 18 ]

Thank you, MaxSH97 

for the JSON, it should be enough to further investigate the issue. No additional tests are needed at the moment.

Regards,

Eriks

Comment by Eriks Sneiders [ 2022 Feb 04 ]

Fixed in:

Documentation updated:

Comment by Maksim Strekalovskikh [ 2023 Feb 13 ]

Hi, @esneiders!

I'm very sorry for the very late message.

I would like to thank you very much for fixing this issue!

Good luck to you!

Generated at Fri May 02 07:10:08 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.