[ZBX-23545] SMART: Failed to scan for devices: Cannot unmarshal JSON: invalid character '\'' looking for beginning of value Created: 2023 Oct 13  Updated: 2023 Nov 23  Resolved: 2023 Nov 23

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

Type: Problem report Priority: Trivial
Reporter: Taras Assignee: Edgar Akhmetshin
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 11 Enterprise/ Server 2019 with smartmontools 7.4-1



 Description   

Steps to reproduce:

  1. Tried to add SMART monitoring for Windows hosts by adding template "SMART by Zabbix agent 2"
  2. Install last Zabbix agent 2 on host, install last smartmontools
  3. Try to check or monitor like
.\zabbix_get.exe -k smart.disk.get -s 127.0.0.1

Result:

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

Expected:
Valid data

Extra info:

.\zabbix_agent2.exe -t smart.disk.get

 give next output:

smart.disk.get                                [s|[{"device":{"info_name":"/dev/sda","name":"/dev/sda","protocol":"NVMe","type":"nvme"},"disk_name":"sda","disk_type":"nvme","firmware_version":"E8FK11.T","json_format_version":[1,0],"local_time":{"asctime":"Fri Oct 13 17:19:57 2023 ","time_t":1697206797},"logical_block_size":512,"model_name":"KINGSTON SA1000M8240G","nvme_controller_id":0,"nvme_error_information_log":{"read":16,"size":16,"table":[{"command_id":36,"error_count":1647,"lba":{"value":127},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":35,"error_count":1646,"lba":{"value":3},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":5,"error_count":1645,"lba":{"value":208},"nsid":0,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":4,"error_count":1644,"lba":{"value":3},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":1,"error_count":1643,"lba":{"value":6},"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":15,"error_count":1642,"lba":{"value":33555712},"nsid":0,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":36,"error_count":1641,"lba":{"value":127},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":35,"error_count":1640,"lba":{"value":3},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":5,"error_count":1639,"lba":{"value":208},"nsid":0,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":4,"error_count":1638,"lba":{"value":3},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":1,"error_count":1637,"lba":{"value":6},"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":15,"error_count":1636,"lba":{"value":33555712},"nsid":0,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":36,"error_count":1635,"lba":{"value":127},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":35,"error_count":1634,"lba":{"value":3},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":5,"error_count":1633,"lba":{"value":208},"nsid":0,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0},{"command_id":4,"error_count":1632,"lba":{"value":3},"nsid":1,"phase_tag":true,"status_field":{"do_not_retry":false,"status_code":2,"status_code_type":0,"string":"Invalid Field in Command","value":2},"submission_queue_id":0}],"unread":0},"nvme_ieee_oui_identifier":9911,"nvme_namespaces":[{"capacity":{"blocks":468862128,"bytes":240057409536},"eui64":{"ext_id":447470121109,"oui":9911},"formatted_lba_size":512,"id":1,"size":{"blocks":468862128,"bytes":240057409536},"utilization":{"blocks":468862128,"bytes":240057409536}}],"nvme_number_of_namespaces":1,"nvme_pci_vendor":{"id":9798,"subsystem_id":9798},"nvme_smart_health_information_log":{"available_spare":100,"available_spare_threshold":10,"controller_busy_time":20621,"critical_comp_time":0,"critical_warning":0,"data_units_read":261408807,"data_units_written":251743742,"host_reads":4487662949,"host_writes":2616733741,"media_errors":0,"num_err_log_entries":1647,"percentage_used":45,"power_cycles":108,"power_on_hours":24184,"temperature":35,"temperature_sensors":[null,35],"unsafe_shutdowns":18,"warning_temp_time":0},"nvme_total_capacity":240057409536,"nvme_unallocated_capacity":0,"nvme_version":{"string":"1.2","value":66048},"power_cycle_count":108,"power_on_time":{"hours":24184},"serial_number":"50026B7682F4C309","smart_status":{"nvme":{"value":0},"passed":true},"smart_support":{"available":true,"enabled":true},"smartctl":{"argv":["smartctl","-a","/dev/sda","-j"],"build_info":"(sf-7.4-1)","exit_status":0,"platform_info":"x86_64-w64-mingw32-w11-22H2","pre_release":false,"svn_revision":"5530","version":[7,4]},"temperature":{"current":35},"user_capacity":{"blocks":468862128,"bytes":240057409536}}]]

 



 Comments   
Comment by Edgar Akhmetshin [ 2023 Oct 16 ]

This template requires smartmontools to be installed and used with correct permissions.

https://www.zabbix.com/documentation/6.0/en/manual/config/templates_out_of_the_box/zabbix_agent2

Please be advised that this section of the tracker is for bug reports only. The case you have submitted can not be qualified as one, so please reach out to [email protected] for commercial support (https://zabbix.com/support) or consultancy services. Alternatively, you can also use our IRC channel or community forum (https://www.zabbix.com/forum) for assistance. With that said, we are closing this ticket. Thank you for understanding.

Comment by Taras [ 2023 Oct 16 ]

Seems like Edgar didn't read details.

Issue is not related to permissions, as there is no specific permissions for Windows machine documented in template. Also, as you can see, direct agent test poll gives result.

Comment by Edgar Akhmetshin [ 2023 Oct 16 ]

Seems like Edgar didn't read details.
Issue is not related to permissions, as there is no specific permissions for Windows machine documented in template. Also, as you can see, direct agent test poll gives result.

Which user is used to execute locally and which user is used to run the process?

We are not able to reproduce the issue, provide exact steps including paths used, user permissions used, etc...

Comment by Taras [ 2023 Oct 16 ]

Which user is used to execute locally and which user is used to run the process?

Both commands  .\zabbix_agent2.exe -t smart.disk.get and .\zabbix_get.exe -k smart.disk.get -s 127.0.0.1 were executed in same shell (and same user).

There is no specific permission modified at all (and not required in documentation for Win) - default installation smartmontools and Zabbix agent.

Installation path also default. There is no any custom modifications made.

Comment by Taras [ 2023 Oct 18 ]

see comment

Comment by Edgar Akhmetshin [ 2023 Oct 19 ]

Both commands .\zabbix_agent2.exe -t smart.disk.get and .\zabbix_get.exe -k smart.disk.get -s 127.0.0.1 were executed in same shell (and same user).

First one will by executed under user permissions, second one will communicate to the daemon with own set of privileges.

There is no specific permission modified at all (and not required in documentation for Win) - default installation smartmontools and Zabbix agent.
Installation path also default. There is no any custom modifications made.

Thank for the clarification, we will check once again.

Comment by Edgar Akhmetshin [ 2023 Nov 22 ]

Cannot reproduce with correctly set 'Plugins.Smart.Path=' (smart.conf) and Agent2 6.0.23.

Provide more details how to reproduce the issue.

Comment by Taras [ 2023 Nov 23 ]

According to https://www.zabbix.com/documentation/6.0/en/manual/appendix/config/zabbix_agent2_plugins/smart_plugin - Plugins.Smart.Path is not mandatory. So or documentation is wrong and Path is mandatory (and template have to be updated), or there is bug and pre-configured Path is wrong.

Did you try to leave it default/commented?

Comment by Taras [ 2023 Nov 23 ]

see comment (again)

Comment by Taras [ 2023 Nov 23 ]

I mean, here is conf:

### Option: Plugins.Smart.Path
#    Path to smartctl executable.
#
# Mandatory: no
# Default: smartctl

And this is not working if smartmontools is just installed by default.
If I change to:

Plugins.Smart.Path="C:\Program Files\smartmontools\bin\smartctl.exe"

It works fine, but I have not to change it. I believe, it is mistake in this default path. Cause if just type "smartctl" in PS/CMD - i`ve got answer from smartmontools. Smartmontools installer adds directory with binaries to PATH, so "smartctl" or other .exe works. Maybe zabbix smart module config cant deal with it and need only absolute path to .exe?

Comment by Edgar Akhmetshin [ 2023 Nov 23 ]

Works as expected. ENV should be configured correctly for the user used to run Agent2, not for the local Windows Administrator. Closing as Won't fix.  

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