[ZBX-20114] Smart plugin in zabbix agent 2 not working (Windows) Created: 2021 Oct 22  Updated: 2024 Apr 10  Resolved: 2022 Nov 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: 5.0.22, 5.4.6
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Василий Никитченко Assignee: Eriks Sneiders
Resolution: Fixed Votes: 6
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified
Environment:

Host: Windows 10 or Windows Server 2019. Smartmontools 7.2. Zabbix agent 2 5.2.7 or 5.4.3.
Zabbix server: 5.2.7 or 5.4.3


Attachments: PNG File image-2022-02-12-18-58-35-681.png     PNG File image-2022-02-12-19-00-26-911.png     PNG File image-2022-02-12-19-01-10-408.png     PNG File image-2022-02-12-19-01-29-761.png     PNG File image-2022-02-12-19-02-39-915.png    
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBX-21484 Update SMART template ReadMe Sub-task Closed Andrey Tocko  
Team: Team INT

 Description   

Steps to reproduce:

  1. Install zabbix agent 2 (tested on 5.2.7 and 5.4.3) on target Windows 10 or Windows server 2019 host.
  2. Install smartmontools latest version.
  3. Add host to zabbix with template smart by zabbix agent 2 (or smart by zabbix agent 2 active).
  4. Wait for item update.

Result:
Items related to smart monitoring show error:
> Failed to scan for devices: Cannot unmarshal JSON: invalid character '\u00ad' after top-level value..
 
Manually added test item "system.run[C:\zabbix\smartmontools\bin\smartctl.exe --scan-open]" returns correct result:
> /dev/sda -d nvme # /dev/sda, NVMe device
 
Manually running smartctl.exe from command line also return correct results.
 
So it is not a permission problem. Tests show that there is no difference if smartmontools installed to default path (C:\Program Files\smartmontools) or to any other directory.
 
Side problem: smartmontools not adding itself into PATH (despite it has default-on option in installer). After adding smartctl to PATH manually, error changes to:

  • Smartctl failed to get device data: unknown error from smartctl.

Expected:
Working smart monitoring.
 



 Comments   
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 the issues.

As for the side problem, the error `Smartctl failed to get device data: unknown error from smartctl.`. Is returned when smartctl returns exit status 2, but does not return a message.

Would it be possible to run `smartctl -a /dev/sda -j` from terminal and share the json, it would help me to reproduce the issue.

 

Edit: The executable path should also be in quotes,  example: `"<path/to/executable.exe>"`

Comment by Pablo [ 2022 Feb 13 ]

Similar problem here:

When execute:

zabbix_agent2 -t smart.disk.get

Result is OK:

 

but when execute

zabbix_get.exe -s 127.0.0.1 -k smart.disk.get

returns error:

ZBX_NOTSUPPORTED: Failed to scan for devices: Cannot unmarshal JSON: invalid character '\'' looking for beginning of value..

 

-----------------

Exe Versions:

zabbix_agent2: 5.4.10

zabbix_get: 5.4.10

smartctl: 7.1

 

 

--------------------

 

Comment by Василий Никитченко [ 2022 Feb 14 ]

I haven't used plugins.smart.path before - no mentions of this field in the description of a smart template. I tested it with full path (including binary) - it works. But template description should be changed. 

Result of the requested command:

smartctl.exe" -a /dev/sda -j
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl":

{     "version": [       7,       2     ],     "svn_revision": "5155",     "platform_info": "x86_64-w64-mingw32-2019",     "build_info": "(sf-7.2-1)",     "argv": [       "smartctl",       "-a",       "/dev/sda",       "-j"     ],     "exit_status": 4   }

,
  "device":

{     "name": "/dev/sda",     "info_name": "/dev/sda",     "type": "scsi",     "protocol": "SCSI"   }

,
  "vendor": "HP",
  "product": "LOGICAL VOLUME",
  "model_name": "HP LOGICAL VOLUME",
  "revision": "8.32",
  "scsi_version": "SPC-3",
  "user_capacity":

{     "blocks": 937637552,     "bytes": 480070426624   }

,
  "logical_block_size": 512,
  "rotation_rate": 0,
  "serial_number": "001438028E13390",
  "device_type":

{     "scsi_value": 0,     "name": "disk"   }

,
  "local_time":

{     "time_t": 1644827303,     "asctime": "Mon Feb 14 11:28:23 2022 RTZ"   }

,
  "temperature":

{     "current": 0,     "drive_trip": 0   }

}

Generated at Wed Apr 30 06:16:54 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.