[ZBX-19950] Smartctl failed to get device data: unknown error from smartctl Created: 2021 Sep 11  Updated: 2025 Apr 24

Status: Need info
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: 5.4.4
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Pah Assignee: Aigars Kadikis
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File smart.disk.get.log     Text File smartctl.txt     File zabbix_agent2.log    

 Description   

I use the official "SMART by Zabbix agent 2".

 

One host I get the following error:

 

# zabbix_agent2 -t smart.disk.get 
smart.disk.get [m|ZBX_NOTSUPPORTED] [Smartctl failed to get device data: unknown error from smartctl.]

 

 

Therefore the status in Zabbix for Device Discovery is "Not supported".

 

I attached the full output from smartctl.

 

I think the problem is that smartctl is returning a non-zero exit code for a device:

 

# /usr/sbin/smartctl -a /dev/hdd -j
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      2
    ],
    "svn_revision": "5155",
    "platform_info": "x86_64-linux-5.4.128-1-pve",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-a",
      "/dev/hdd",
      "-j"
    ],
    "exit_status": 2
  },
  "device": {
    "name": "/dev/hdd",
    "info_name": "/dev/hdd",
    "type": "ata",
    "protocol": "ATA"
  }
}

 

 



 Comments   
Comment by Aigars Kadikis [ 2021 Sep 13 ]

Thank you for contacting us.

Please also do the 'strace' per process by using the following command:

strace -s 256 -o /tmp/smart.disk.get.log zabbix_agent2 -t smart.disk.get

What kind of OS it is where it is not working?

cat /etc/*release* 

Does the SELinux is on?:

getenforce

BTW, code-wise, the error is defined:

https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/go/plugins/smart/smartfs.go?at=refs%2Fheads%2Frelease%2F5.4#326

Comment by Pah [ 2021 Sep 14 ]

Here are the requested outputs:

# strace -s 256 -o /tmp/smart.disk.get.log zabbix_agent2 -t smart.disk.get 
smart.disk.get                                [m|ZBX_NOTSUPPORTED] [Smartctl failed to get device data: unknown error from smartctl.] 
# cat /etc/*release*  
PRETTY_NAME="Debian GNU/Linux 10 (buster)" 
NAME="Debian GNU/Linux" 
VERSION_ID="10" 
VERSION="10 (buster)" 
VERSION_CODENAME=buster 
ID=debian 
HOME_URL="https://www.debian.org/" 
SUPPORT_URL="https://www.debian.org/support" 
BUG_REPORT_URL="https://bugs.debian.org/" 
# getenforce 
-bash: getenforce: command not found

 

The system is runnig Proxmox VE 6.4 on Debian 10. Without SELinux.

But I have the same issue on another host with Proxmox VE 7.0 on Debian 11.

 

The disk mentioned above with the non-zero exit code is a folder with symlinks to ZFS disks of a VM, hence the error from smartctl.

# ls -alh /dev/hdd 
total 0 
drwxr-xr-x  2 root root  100 Aug 15 21:26 . 
drwxr-xr-x 23 root root 4.8K Sep  6 10:39 .. 
lrwxrwxrwx  1 root root    7 Aug 15 21:26 vm-100-disk-0 -> ../zd32 
lrwxrwxrwx  1 root root    9 Aug 15 21:26 vm-100-disk-0-part1 -> ../zd32p1 
lrwxrwxrwx  1 root root    9 Aug 15 21:26 vm-100-disk-0-part2 -> ../zd32p2

 

Perhaps Zabbix Agent 2 should ignore the disk so that at least the data of the others can be displayed? Either by itself, or with the option to specify the disks to be ignored in a Macro. It was not possible for me to let smartctl ignore the disk.

Comment by Aigars Kadikis [ 2021 Sep 14 ]

Thank you for the descriptive context.

Please also include /tmp/smart.disk.get.log. Maybe it will highlight, the agent2 fails on the non-zero part:

/usr/sbin/smartctl -a /dev/hdd -j
Comment by Pah [ 2021 Sep 14 ]

I've added /tmp/smart.disk.get.log.

Comment by Pah [ 2021 Nov 30 ]

Can I provide more information to solve this?

Comment by Aigars Kadikis [ 2021 Dec 06 ]

In smart.disk.get.log, I did not find a sign to the problem.

If you know how to create a virtual ZFS disk on Debian 10 and mount it as in your example, that would help. How we can simulate problem on Debian 10 without actual hardware equipment?

Comment by Martin Novak [ 2022 Apr 22 ]

For anyone who encounters this problem - we've had the same issue with Proxmox 7 (which is essentially just Debian 11) and we fixed the problem by installing sudo.

I assume the same would apply for Proxmox 6 (Debian 10).

Comment by Pah [ 2022 Apr 24 ]

I had the problem with missing sudo before, but the error was different. sudo is installed.

After upgrading to Zabbix Agent 6.0.3 something has changed, but it isn't working too.

# zabbix_agent2 -t smart.disk.get  
smart.disk.get                                [m|ZBX_NOTSUPPORTED] [Timeout occurred while gathering data.]

@Aigars Kadikis Would it be possible for you to install Proxmox in a VM? Then I would try to reproduce it in a VM and provide you with step-by-step instructions. Or I could make the entire VM available as a download.

 

Comment by Aigars Kadikis [ 2022 Apr 26 ]

Hi Pah, Martin,

More logging per SMART monitoring has been included in recent LTS agents. Please install DebugLevel=5 in zabbix_agent2.conf.

Use zabbix_get utility from proxy/server to simulate LLD rule:

zabbix_get -s ip.address.of.agent2 -p 10050 -k smart.disk.get

The logging has been added to 5.0 and 6.0 agents. If Zabbix version is 5.4, then we need to test with agent2 5.0.22.

Comment by Pah [ 2022 Apr 27 ]

I've added DebugLevel=5 and restarted the Agent. Didn't use zabbix_get because the zabbix port isn't reachable from the zabbix server (no port forwarding).

Here ist the log: zabbix_agent2.log

In line 742 "smart.disk.get" is called.

Comment by TAKETO Noguchi [ 2025 Apr 24 ]

I have the same problem. When the exit status of the smartctl command is not 0, the Zabbix agent 2 does not work correctly.

$ zabbix_agent2 -V
zabbix_agent2 (Zabbix) 7.0.12
Revision ada4cd46eae 22 April 2025, compilation time: Apr 22 2025 09:30:57, built with: go1.24.1
Plugin communication protocol version is 6.4.0
Copyright (C) 2025 Zabbix SIA
License AGPLv3: GNU Affero General Public License version 3 <https://www.gnu.org/licenses/>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
Compiled with OpenSSL 3.0.13 30 Jan 2024
Running with OpenSSL 3.0.13 30 Jan 2024
We use the library Eclipse Paho (eclipse/paho.mqtt.golang), which is
distributed under the terms of the Eclipse Distribution License 1.0 (The 3-Clause BSD License)
available at https://www.eclipse.org/org/documents/edl-v10.php
We use the library go-modbus (goburrow/modbus), which is
distributed under the terms of the 3-Clause BSD License
available at https://github.com/goburrow/modbus/blob/master/LICENSE

 

Comment by TAKETO Noguchi [ 2025 Apr 24 ]

This problem occurs in 7.0 but not in 6.0.

Comment by TAKETO Noguchi [ 2025 Apr 24 ]

zabbix_agent2.log is

check 'smart.disk.get[/dev/sda,"sat"]' is not supported: Cannot fetch data.: failed to execute smartctl: " ... <json string> ... ": exit status 64.
Generated at Sun May 04 06:42:48 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.