mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.
https://www.monitorix.org
GNU General Public License v2.0
1.12k stars 167 forks source link

Issue with hdd temperature when one disk is unavailable and hddtemp is present #400

Closed H-Sachse closed 2 years ago

H-Sachse commented 2 years ago

I habve a 4-bay usb enclosure, where hddtemp returns e.g. /dev/sda: WDC WD20EARX-00MMMB0: drive supported, but it doesn't have a temperature sensor. I had to disable (rename) the hddtemp executable so monitorix would fall back to smartctl for the temperature readings.

It would be better to fall back to smartctl whenever hddtemp does not return an number for the temperature.

mikaku commented 2 years ago

It would be better to fall back to smartctl whenever hddtemp does not return an number for the temperature.

In fact this works in the opposite way. It first checks smartctl and only in the case when there is no temperature collected, then it calls hddtemp.

I'm monitoring a disk where hddtemp returns a message without a temperature value:

# hddtemp /dev/sde
/dev/sde: WD Elements 1042: S.M.A.R.T. not available

but smartctl returns good information:

# smartctl -A /dev/sde
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.16.8-100.fc34.x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   157   153   021    Pre-fail  Always       -       3141
  4 Start_Stop_Count        0x0032   099   099   000    Old_age   Always       -       1517
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   068   068   000    Old_age   Always       -       23483
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       361
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       41
193 Load_Cycle_Count        0x0032   165   165   000    Old_age   Always       -       107963
194 Temperature_Celsius     0x0022   117   104   000    Old_age   Always       -       30
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0

and all is working fine.

H-Sachse commented 2 years ago

Hmm, that one must have been a fluke on my side. I re-enabled hddtemp and the tempeatures are still shown OK.

Closing.

H-Sachse commented 2 years ago

I'll have to reopen this one. I did another experiment and this is the output: image On this machine the sda is attached via sata and hddtemp and smartctl both deliver good values. sdb is not present. before 17:30, hddtemp was available, then I made hddtemp unavailable. around 17:50 I made hddtemp available again for a few minutes. Maybe the issue is not the fallback, but the different handling of unavailable disks. With hddtemp unavailable, at least the temperature for the available disks is captured.

mikaku commented 2 years ago

sdb is not present.

You cannot monitor any disk if one of the disks specified in <list> does not exist.

<disk>
        <list>
                0 = /dev/sda, /dev/sdb, /dev/sdf
        </list>
[...]
Wed Mar  2 09:17:42 2022 - disk::disk_init: ERROR: invalid or inexistent device name '/dev/sdf'.
Wed Mar  2 09:17:42 2022 - disk::disk_init: 'accept_invalid_disk' option is not set.
Wed Mar  2 09:17:42 2022 - disk::disk_init: WARNING: initialization aborted.

How can I reproduce your problem?

H-Sachse commented 2 years ago

I do have it running at the moment with one disk attached and two configured:

<disk>
    <list>
        0 = /dev/sda, /dev/sdb
    </list>
        accept_invalid_disk = y
    use_nan_for_missing_data = y
    gap_on_all_nan = y
</disk>

see https://github.com/mikaku/Monitorix/issues/400#issuecomment-1040610047 for how it looks like when hddtemp is made available.

mikaku commented 2 years ago

I've applied your options, and after 13:00h I removed hddtemp from my system:

# hddtemp
-bash: hddtemp: command not found

As you can see, there is no difference before and after the deletion of hddtemp in the graph:

test

H-Sachse commented 2 years ago

I just checked again, and it looks like after updating the system from debian buster to bullseye after raising the issue, the issue has gone away. Might have been the kernel update from 4.9 to 4.19. The hddtemp version was the same before and after: 0.3-beta15 I suppose we can close this one as well, since the issue is no longer present with a recent kernel.

mikaku commented 2 years ago

I just checked again, and it looks like after updating the system from debian buster to bullseye after raising the issue, the issue has gone away.

That's weird. OK let's close it, and feel free to reopen it if the issue comes again.