Home assistant addon : Scrutiny (SMART dashboard)

Hello @alexbelgium, I finally know how to configure my USB NVME enclosure in Scrutiny, but for that, I would need to modify the collector.yaml config file. Would you be able to expose it for your add-on? Thanks!

Hello Alex and Everyone, I have recently installed Scrutiny on my Rpi-4 based HA (running on NVMe SSD conncted via USB 3.0 port using SMART supported enclosure). However, I couldn’t get SMART info nor temperature. All the time I am getting errors recorded in the log file as below. Can some help me understand what I am doing wrong here? Does Scrutiny not support Rpi-4 base HA OS? My Scrutiny WebUI page was empty until now and after updating it to v0.5.0-6test, WebUI does not load at all and it just keep showing scrutiny logo and three pink dots! Thanks for your help.

JSON result was not a dictionary or list with 0th element a dictionary

19:38:31 – (WARNING) RESTful - message first occurred at 6 December 2022 at 00:42:31 and shows up 2574 times

REST result could not be parsed as JSON

19:38:31 – (WARNING) RESTful - message first occurred at 6 December 2022 at 00:42:31 and shows up 5148 times

Empty reply found when expecting JSON data

19:28:31 – (WARNING) RESTful - message first occurred at 19:26:31 and shows up 9 times

Error fetching data: http://192.168.1.100:8096/api/summary failed with All connection attempts failed

19:28:31 – (ERROR) RESTful - message first occurred at 19:26:31 and shows up 9 times

I have a similar problem, running HassOS on Rpi-4b, booting from USB in SMART-supported enclosure via USB 3.0 port. After installing the add-on, the web UI loads ok and yet it shows know data. In the add-on log, I get this message:
Could not retrieve device information for sda: exit status 2
There are no other error messages I can see in that log or in the Supervisor log.

I tried the HDD Tools add-on and wasn’t able to get any SMART data there, either (its sensor just reported temperature=null).

Have others actually got this working with HassOS? Or with a similar config involving USB SSD for boot and data?

Hi, done through github request :

if bashio::config.true "expose_collector"; then
    bashio::log.info "collector.yaml exposed in /share/scrutiny. It will only be accessible if the addon is running"

It might be the solution to the two other issues above…

Hello, I get this in the log and /share/scrutiny is an empty folder:

[13:50:13] INFO: collector.yaml exposed in /share/scrutiny. It will only be accessible if the addon is running
cp: cannot stat '/data/config/collector.yaml': No such file or directory
rm: cannot remove '/data/config/collector.yaml': No such file or directory

By the way, would it not make more sense to have it in config instead of share?

The error is gone in the latest version, but it looks like I need the functionality in the full access version, because I always tested on that one. The standard version of Scrutiny gives me this in the log after I made my changes to collector.yaml:

time="2022-12-27T21:00:01+01:00" level=info msg="Verifying required tools" type=metrics
time="2022-12-27T21:00:01+01:00" level=info msg="Executing command: smartctl --scan --json" type=metrics
time="2022-12-27T21:00:01+01:00" level=info msg="Executing command: smartctl --info --json --device sntjmicron /dev/sda" type=metrics
time="2022-12-27T21:00:01+01:00" level=error msg="Could not retrieve device information for sda: exit status 2" type=metrics

This is in line with trying directly from the container’s console:

root@db21ed7f-scrutiny:/opt/scrutiny# smartctl --all -d sntjmicron /dev/sda
smartctl 7.2 2020-12-30 r5155 [aarch64-linux-5.15.80] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

Smartctl open device: /dev/sda [USB NVMe JMicron] failed: Operation not permitted

My collector.yaml looks like this:

devices:
  - device: /dev/sda
    type: 'sntjmicron'

But when I try directly from the full access version, I get the correct results:

root@db21ed7f-scrutiny-fa:/opt/scrutiny# smartctl --all -d sntjmicron /dev/sda
smartctl 7.2 2020-12-30 r5155 [aarch64-linux-5.15.80] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       ADATA SX8200PNP
Serial Number:                      #########
Firmware Version:                   42AZS6AC
PCI Vendor/Subsystem ID:            0x1cc1
IEEE OUI Identifier:                0x000000
Controller ID:                      1
NVMe Version:                       1.3
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,024,209,543,168 [1.02 TB]
Namespace 1 Utilization:            646,954,123,264 [646 GB]
Namespace 1 Formatted LBA Size:     512
Local Time is:                      Tue Dec 27 21:29:23 2022 CET
Firmware Updates (0x14):            2 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005f):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Log Page Attributes (0x0b):         S/H_per_NS Cmd_Eff_Lg Telmtry_Lg
Maximum Data Transfer Size:         64 Pages
Warning  Comp. Temp. Threshold:     75 Celsius
Critical Comp. Temp. Threshold:     80 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W       -        -    0  0  0  0        0       0
 1 +     4.60W       -        -    1  1  1  1        0       0
 2 +     3.80W       -        -    2  2  2  2        0       0
 3 -   0.0450W       -        -    3  3  3  3     2000    2000
 4 -   0.0040W       -        -    4  4  4  4    15000   15000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        37 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    1%
Data Units Read:                    29,199,048 [14.9 TB]
Data Units Written:                 20,366,054 [10.4 TB]
Host Read Commands:                 790,413,091
Host Write Commands:                392,290,447
Controller Busy Time:               36,038,382
Power Cycles:                       162
Power On Hours:                     11,005
Unsafe Shutdowns:                   114
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Thermal Temp. 1 Transition Count:   8
Thermal Temp. 2 Transition Count:   4
Thermal Temp. 1 Total Time:         141
Thermal Temp. 2 Total Time:         24

Error Information (NVMe Log 0x01, 16 of 256 entries)
No Errors Logged
1 Like

Hi, thanks for the feedback, I’ve just pushed a new version to align codes from both addons

I still do not see the option to expose collector.yaml in the configuration tab of the Full Access version of the add-on.

Scrutiny Full Access latest version works for me with the collector.yaml I shared in Home assistant addon : Scrutiny (SMART dashboard) - #69 by hubikj.

1 Like

Hi hubikj, Are you using HA on Rpi-4 or as docker or on computer?

Finally after debugging a lot and entering inside grafana’s container, I managed to get smart data from scrutiny as below :partying_face: (no wonder I see my SMART data failed as there was some issue but I rectified it now.) I am using HA on Rpi-4b model and SSD is connected through NVMe enclosure (Realtek RTL9210B chip) so now learned that scrutiny (full access) works just fine on Rpi-4.

Couple of important things, I’d like to mention here to get scrutiny working: (1) My SSD enclosure chip is Realtek RTL9210B so scrutiny (as per smartmontools) I should get SMART data if I set smartctl_command_device_type to auto or sntrealtek but it does not work that way probably because old kernel does not support. I could see while debuging that auto device type was selecting sntrealtek automatically internally and log was generatting following error

time="2023-01-01T12:44:49Z" level=info msg="Verifying required tools" type=metrics
time="2023-01-01T12:44:49Z" level=info msg="Executing command: /usr/sbin/smartctl --scan --json --dev auto" type=metrics
time="2023-01-01T12:44:49Z" level=info msg="Executing command: /usr/sbin/smartctl --info --json --dev auto --device sntrealtek /dev/sda" type=metrics
time="2023-01-01T12:44:49Z" level=error msg="Could not retrieve device information for sda: exit status 2" type=metrics
time="2023-01-01T12:44:49Z" level=info msg="Sending detected devices to API, for filtering & validation" type=metrics

So important here is to set device type sat and do not leave it auto. I got this tip from smartmontools wiki. and (2) scrutiny retrives SMART data only in full access mode otherwise it will generate similar error as above. Docker scrutiny is already a member of the group “disk” so technically there should not be a problem but it does not get permission to get to the hardware. (3) Protection mode must be disabled in scrutiny (full access) otherwise it will not be able to get SMART data for the same reason.

1 Like

@nate.eaton.jr Hi, See my previous comment. This might help you as well :wink:

Thanks, that helped! For me, it just took installing the Full Access add-on with protection mode disabled and now I’m getting results. Although I didn’t have to explicitly specify the device type for it to work, I went back and did that, too.

As I’d had some lagginess in my HASSOS platform a while back, I had wanted to be sure it wasn’t the SSD having issues. The good news is that the lagginess seemed to have (mostly) resolved so I wasn’t stressing about access to SMART data any more but I really want to have a complete view of the hub so this is great to finally have.

2 Likes

I am using Home Assistant Blue with external NVME SSD.

Alright. Thanks. My problem is now got solved.

Do we need to do anything special for the disks to show up?
I use Scrutiny on a few other systems, and we usually have to pass through some variables at container runtime for the disks to show, but I dont see an option here for this container?

Thanks!

##EDIT##
Reading above, it looks to be a similar thing experienced by someone else, with a USB enclosure perhaps being an issue.
Is there any workaround for a Realtek based enclosure?

Some RealTek chips work in auto mode and some in sat only. Try seting smartctl_command_device_type either auto or sat and make sure you have disabled protection from scrutiny (full access) info tab. Observe your logs afterwords it this doesn’t work!

Thanks, that did it.
SAT mode, protection off on the ‘full’ version. :slight_smile:

2 Likes

Sorry for the probably stupid question, but I’m unable to add the repo. I went to Settings > Add-ons > Store > Top-right menu > Repositories > added this URL https://github.com/alexbelgium/hassio-addons… Then it spinned, spinned, and nothing happened. Going for “check for updates” eventually causes a popup telling me to check logs. There, I found two error logs:

Logger: homeassistant.components.hassio
Source: components/hassio/websocket_api.py:124
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: 23:08:49 (3 occurrences)
Last logged: 23:20:08
Failed to to call /addons/reload -
------------------------------------------
Logger: homeassistant.components.hassio.handler
Source: components/hassio/handler.py:476
[same]
Timeout on /addons/reload request

This doesn’t happen if I remove the repository or add the example repository from the HA docs…

Running Home Assistant 2023.2.5, Supervisor 2023.01.1, Operating System 9.5.

Any help is appreciated!

Dear all,
i hope you can help with an issue I have with Scrutiny. The Add-on is great and shows me all the necessary data in the dashboard. But I would like to setup a sensor for warning purpose for specific data points, such as LBA written , power-on-hours or endurance remaining.
Unfortunately I can’t get it working to show me the data. HA logs shows me a warning:
JSON result was not a dictionary or list with 0th element a dictionary.
Which seems that the json attribute path is incorrect. The sensor only shows “OK” and no value at all.
I used the below example and updated IP and ADDONPORT accordingly. Clicking the link gives me a list of datapoints. So looks like the information is available.
Thank you in advance and greeting

rest:
- verify_ssl: false
scan_interval: 60
    resource: http://192.168.178.73:8086/api/device/4935015148310673/details
    sensor:
      - name: "HDD disk 1"
        json_attributes_path: "$.data[0].smart_results[0]"
        value_template: "OK"
        json_attributes:
          - "device_wwn"
          - "date"
          - "smart_status"
          - "temp"
          - "power_on_hours"
          - "power_cycle_count"
          - "ata_attributes"
          - "nvme_attributes"
          - "scsi_attributes"

Issue has been resolved. I used JSON Path Finder to find the correct path and attributes. Readout with
sensor:

       - name: "HDD_disk_HA"

        value_template: "Healthy"

        json_attributes_path: "data.summary.4935015148310673"

        json_attributes:

          - device

          - smart

      - name: "HDD_Model"

        value_template: "{{ state_attr('sensor.hdd_disk_ha','device').model_name }}"
1 Like