[ZBX-19103] Error in SMART disk discovery. Created: 2021 Mar 09  Updated: 2024 Apr 10  Resolved: 2021 Mar 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: None
Fix Version/s: 5.0.10rc1, 5.2.6rc1, 5.4.0beta2, 5.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Aleksandrs Larionovs (Inactive) Assignee: Eriks Sneiders
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team A
Sprint: Sprint 74 (Mar 2021)
Story Points: 1

 Description   

Moved from: ZBXNEXT-6339

Thanks for the answer. I took your advice and understood how it works.

But I ran into some problem (possibly a bug). Agent 2 version - 5.2.5, OS - Windows 10

If I use the smartctl disk listing command on the local machine, I get this result:

c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe --scan
/dev/sda -d ata # /dev/sda, ATA device
/dev/sdb -d ata # /dev/sdb, ATA device
/dev/csmi0,0 -d ata # /dev/csmi0,0, ATA device
/dev/csmi0,1 -d ata # /dev/csmi0,1, ATA device
/dev/csmi0,3 -d ata # /dev/csmi0,3, ATA device

If you make a request with a module command via zabbix_get, the result is different:

root@ZABBIX-SKUD:~# zabbix_get -s 10.100.40.108 -p 10150 -k smart.disk.discovery
[{
 "{#NAME}": "sda",
 "{#DISKTYPE}": "HDD",
 "{#MODEL}": "ST1000DM003-1ER162",
 "{#SN}": "Z4Y1S7B6"
 },{
 "{#NAME}": "sdb",
 "{#DISKTYPE}": "HDD",
 "{#MODEL}": "ST4000DM000-1F2168",
 "{#SN}": "Z300D821"
}]

But he may be like that:

root@ZABBIX-SKUD:~# zabbix_get -s 10.100.40.108 -p 10150 -k smart.disk.discovery
[{
 "{#NAME}": "csmi0,1",
 "{#DISKTYPE}": "HDD",
 "{#MODEL}": "ST4000DM000-1F2168",
 "{#SN}": "Z300D821"
 },{
 "{#NAME}": "csmi0,0",
 "{#DISKTYPE}": "HDD",
 "{#MODEL}": "ST1000DM003-1ER162",
 "{#SN}": "Z4Y1S7B6"
}]

As you can see, the names of the disks change, it happens that they are mixed with each other. As a result, the following errors appear in the data items:

In the above example, there are only two hard drives, the third item is CD-ROM Drive. The smartctl utility does not always display smart information for both types of drive names.

In the example described, there are only two hard drives, the third item is CD-ROM Drive. The smartctl utility does not always display smart information for both types of drive names. I faced this problem before the release of the module for zabbix2, when I tried to do disk polling using smartmontools myself. In smartmontool, you can specify the media type when listing drives, for example:

 

c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe -j --scan -d
{
 "json_format_version":[1,0],
 "smartctl":{"version":[7,2],
 "svn_revision":"5155",
 "platform_info":"i686-w64-mingw32-w10-1809(64)",
 "build_info":"(sf-7.2-1)",
 "argv":["smartctl","-j","--scan","-d"],
 "messages":[{
 "string":"=======> ARGUMENT REQUIRED FOR OPTION: d","severity":"error"},{"string":"=======> VALID ARGUMENTS ARE: ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], sntrealtek, intelliprop,N[+TYPE], jmb39x[-q],N[,sLBA][,force][+TYPE], jms56x,N[,sLBA][,force][+TYPE], aacraid,H,L,ID, areca,N[/E], auto, test <=======","severity":"error"}],"exit_status":1}
}
c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe -j --scan -d ata
{
 "json_format_version":[1,0],
 "smartctl":{
 "version":[7,2],
 "svn_revision":"5155",
 "platform_info":"i686-w64-mingw32-w10-1809(64)",
 "build_info":"(sf-7.2-1)",
 "argv":["smartctl","-j","--scan","-d","ata"],"exit_status":0
 },
 "devices":[
 {"name":"/dev/sda","info_name":"/dev/sda","type":"ata","protocol":"ATA"},
 {"name":"/dev/sdb","info_name":"/dev/sdb","type":"ata","protocol":"ATA"}]
}
c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe -j --scan -d csmi
{
 "json_format_version":[1,0],
 "smartctl":{
 "version":[7,2],
 "svn_revision":"5155",
 "platform_info":"i686-w64-mingw32-w10-1809(64)",
 "build_info":"(sf-7.2-1)",
 "argv":["smartctl","-j","--scan","-d","csmi"],"exit_status":0},
 "devices":[
 {"name":"/dev/csmi0,0","info_name":"/dev/csmi0,0","type":"ata","protocol":"ATA"},
 {"name":"/dev/csmi0,1","info_name":"/dev/csmi0,1","type":"ata","protocol":"ATA"},
 {"name":"/dev/csmi0,3","info_name":"/dev/csmi0,3","type":"ata","protocol":"ATA"}]
}

 

But on computers that display multiple drive name formats, you need to manually check for the correct one. Until now, I have not been able to understand by what sign or parameter they can be determined automatically.



 Comments   
Comment by Eriks Sneiders [ 2021 Mar 19 ]

Fixed in:

Generated at Tue May 06 07:32:19 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.